2015-04-20 39 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” 将您的页脚视图。