您的位置:首页 > 移动开发 > Android开发

Android布局:保持在底部的按钮栏,上面是滚动的ScrollView的实现方式

2012-11-30 11:37 633 查看
   第一种: (相对布局来实现)

   <?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout

 xmlns:android="http://schemas.android.com/apk/res/android"    

android:layout_width="fill_parent"     android:layout_height="fill_parent"> 

        <LinearLayout       

android:id="@+id/buttonLayout"       

android:layout_alignParentBottom="true"         

android:layout_height="wrap_content" 

              android:layout_width="fill_parent"        

android:orientation="horizontal"> 

              <Button  android:text="BBBB"   

android:layout_height="wrap_content"  

android:layout_width="fill_parent"  

android:layout_weight="1"/> 

       </LinearLayout> 
        <ScrollView  

 android:layout_above="@id/buttonLayout"   

android:layout_width="fill_parent"  

android:layout_height="fill_parent"> 

       </ScrollView> 
</RelativeLayout> 

   第二种: (权重来实现)
<LinearLayout  

android:layout_height="fill_parent"   

android:id="@+id/relativeLayout1"  

android:layout_width="match_parent" 

android:orientation="vertical" >

          <ScrollView   

android:layout_height="0dp"  

android:id="@+id/scrollView1"  

android:layout_width="match_parent"  

android:layout_weight="8"  >

  。。。。。。

         </ScrollView>
          <LinearLayout  

android:layout_height="0dp"   

android:id="@+id/llybuttom"  

android:layout_width="match_parent"   

android:orientation="vertical"   

android:background="@color/black"   

android:layout_weight="1" >

  <Button  

android:id="@+id/btregist"   

android:layout_height="wrap_content"   

android:layout_width="match_parent" />

</LinearLayout>
</LinearLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: