Android:ScrollView+;视图翻转器+;底杆
我正在尝试构建一个如下结构的活动:Android:ScrollView+;视图翻转器+;底杆,android,Android,我正在尝试构建一个如下结构的活动: 顶栏 滚动视图 >视窗翻转器 底杆 我所做的是: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Line
- 顶栏
- 滚动视图
- >视窗翻转器
- 底杆
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout style="@style/TitleBar">
TOP BAR
</LinearLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ViewFlipper android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
VIEW FLIPPER
</ViewFlipper>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@android:drawable/bottom_bar"
android:gravity="center_vertical">
BOTTOM BAR
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
顶杆
视图翻转器
底杆
当然,这是行不通的
事实上,底部栏似乎隐藏在视图翻转器
下。
我如何解决这个问题?我将尝试通过以下方式实现这一点:
<LinearLayout style="@style/TitleBar">
TOP BAR
</LinearLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:fillViewport="true" >
<ViewFlipper android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
VIEW FLIPPER
</ViewFlipper>
</ScrollView>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@android:drawable/bottom_bar"
android:gravity="center_vertical">
BOTTOM BAR
</LinearLayout>
顶杆
视图翻转器
底杆
您可以使用weights
进行此操作。
试试这个:
<ViewFlipper android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
VIEW FLIPPER
</ViewFlipper>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="10dp"
android:background="@android:drawable/bottom_bar"
android:gravity="center_vertical">
BOTTOM BAR
</LinearLayout>
视图翻转器
底杆
这将为
视图翻转器
和第二个线性布局
提供相等的空间。外部布局是线性布局。将底部栏放在ScrollView下也不起作用。