布局文件类似这样:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">        <ScrollView android:layout_width="fill_parent" android:id="@+id/scrollView1"
                android:layout_height="wrap_content" android:scrollbars="none">                <LinearLayout android:id="@+id/linearLayout1"
                        android:layout_width="fill_parent" android:layout_height="wrap_content"
                        android:orientation="vertical">                        <TextView android:text="动态设置超长的字符串 ... 省略 N 个字,N = 灰常大!" android:id="@+id/textView1"
                                          android:layout_width="wrap_content" android:layout_height="wrap_content">
                        </TextView>                </LinearLayout>        </ScrollView>
        <Button android:gravity="center_horizontal" 
                        android:text="这个Button 要固定在屏幕的底部,不随ScrollView 内容的变化而改变位置,请问如何实现?"
                        android:id="@+id/button1" android:layout_width="wrap_content"
                        android:layout_alignParentBottom ="true"
                        android:layout_marginLeft="10px"        
                        android:layout_height="wrap_content">
    </Button>
        
</LinearLayout>

解决方案 »

  1.   

    android:layout_alignParentBottom="true"
    你把button放到layout中,在layout中加入上面的属性,试试~~好像是,不对的话再问我
      

  2.   

    给scroll添加layout_weight就可以实现,修改后的代码如下<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="fill_parent"
      android:layout_height="fill_parent">  <ScrollView android:layout_width="fill_parent" android:id="@+id/scrollView1"
      android:layout_height="wrap_content" android:scrollbars="none" android:layout_weight="1.0">  <LinearLayout android:id="@+id/linearLayout1"
      android:layout_width="fill_parent" android:layout_height="wrap_content"
      android:orientation="vertical">  <TextView android:text="动态设置超长的字符串 ... 省略 N 个字,N = 灰常大!" android:id="@+id/textView1"
      android:layout_width="wrap_content" android:layout_height="wrap_content">
      </TextView>  </LinearLayout>  </ScrollView>
      <Button android:gravity="center_horizontal"  
      android:text="这个Button 要固定在屏幕的底部,不随ScrollView 内容的变化而改变位置,请问如何实现?"
      android:id="@+id/button1" android:layout_width="wrap_content"
      android:layout_alignParentBottom ="true"
      android:layout_marginLeft="10px"   
      android:layout_height="wrap_content">
      </Button>
        
    </LinearLayout>
      

  3.   


    顶3楼,另外的做法可以是将scrollview的weight设为n,button的weight设为1。
    至于n为多少自己斟酌。就可以实现让按钮在底部了
      

  4.   

    <RelativeLayout><ScrollView></ScrollView>
    <Button android:layout_alignParentBottom="true"/></RelativeLayout>
      

  5.   

    <LinearLayout><ScrollView></ScrollView></LinearLayout>
    这是一种方法!常用的!楼上的好多都可以实现你那效果!呵呵