今天在布局中,加入scrollview,以及实现一个button在scrollview底部,scrollview滑动,底部button保持不动,经过几次尝试成功,非常简单,代码如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android_custom="http://schemas.android.com/apk/res/cn.doolii.doolii"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout //此处是重点 设置权重 这样就可以实现 button在底部不滑动
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/bg_grey"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<Button
android:id="@+id/pro_details_bt_bid"
style="@style/normal_confirm_button"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="立即加入"
android:layout_alignParentBottom="true"
android:gravity="center" />
</LinearLayout>
</LinearLayout>