简体   繁体   English

Android:ScrollView + ViewFlipper +底部栏

[英]Android: ScrollView + ViewFlipper + Bottom Bar

I am trying to build an activity structured as follows: 我正在尝试构建一个结构如下的活动:

  • TopBar 顶栏
  • ScrollView 滚动视图
  • > ViewFlipper > ViewFlipper
  • Bottom Bar 底栏

What I have done is: 我所做的是:

<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>

This, of course, is not working. 当然,这是行不通的。

In fact, it seems the bottom bar is hidden under the viewflipper . 实际上,底部栏似乎隐藏在viewflipper How can I fix this? 我怎样才能解决这个问题?

I'd try to achieve this in the following way: 我将尝试通过以下方式实现这一目标:

<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>

You can use weigths for this. 您可以为此使用weigths Try this: 尝试这个:

<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>

That will give equal space to the ViewFlipper and the second LinearLayout . 这将为ViewFlipper和第二个LinearLayout提供相等的空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM