簡體   English   中英

Android:ScrollView + ViewFlipper +底部欄

[英]Android: ScrollView + ViewFlipper + Bottom Bar

我正在嘗試構建一個結構如下的活動:

  • 頂欄
  • 滾動視圖
  • > ViewFlipper
  • 底欄

我所做的是:

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

當然,這是行不通的。

實際上,底部欄似乎隱藏在viewflipper 我怎樣才能解決這個問題?

我將嘗試通過以下方式實現這一目標:

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

您可以為此使用weigths 嘗試這個:

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

這將為ViewFlipper和第二個LinearLayout提供相等的空間。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM