2015-04-20 37 views
0

我沒有使用ListView。我必須在屏幕末尾顯示頁腳文本,而不是在佈局的所有項目下。我該怎麼做?頁尾在屏幕末尾

+3

使用'FrameLayout'並將'Layout'設置爲'gravity =「Bottom」' –

+2

這是一個非常普遍的問題。這表明您在提問之前沒有研究過任何問題。如果您嘗試搜索而不是直接要求它在SO –

+1

請參閱此鏈接: http://stackoverflow.com/questions/13277785/how-to-have-a-fixed-footer-with-scrollview-in- android 希望這會有幫助.. – anju

回答

0

你可以做這樣的事情

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:orientation="horizontal" > 

     <Button 
      android:id="@+id/frag1" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" 
      android:text="Button" /> 

     <Button 
      android:id="@+id/frag2" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" 
      android:text="Button" /> 
    </LinearLayout> 
</RelativeLayout> 
0

使用線性佈局,重量:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:id="@+id/lnrContainer" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"> 

     </LinearLayout> 


    <LinearLayout 
     android:id="@+id/lnrFooter" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    </LinearLayout> 

</LinearLayout> 
0

我認爲你可以使用的RelativeLayout,並添加layout_alignParentBottom = 「true」 將您的頁腳視圖。