我正在开发Android应用程序,需要listview和底部的android按钮..按钮需要与listview内容一起滚动,而不是固定在屏幕的末尾。
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/requestlist"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/white"
android:visibility="visible"/>
<Button
android:text="Save"
style="@style/btn_white_large"
android:layout_width="120dp"
android:layout_gravity="center"
android:layout_height="40dp"
android:id="@+id/btn" />
</LinearLayout>
</ScrollView>
答案 0 :(得分:3)
您可以将此按钮放在不同的xml文件中,并在视图中对该xml进行充气。 然后尝试使用listview.addFooter(view)
同时从此布局中删除滚动视图
答案 1 :(得分:0)
你能将LinearLayout放在NestedScrollView而不是ScrollView吗?它会一起滚动。