I have a layout, something like a page. I have a list view and at the bottom of the list i need to have a button. It has to be under the List View, not sticking at the bottom of the screen. (Like you have to scroll all the way down through the list to get that button.) The structure I am using:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView
android:id="@ id/show_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:dividerHeight="7dp"
android:paddingHorizontal="25dp"
android:scrollbars="none"
android:scrollingCache="false" />
<LinearLayout>
//My button here
</LinearLayout>
</LinearLayout>
</ScrollView>
MAIN ISSUE: Scrolling ends at the last item of ListView, Button stays out of screen. Why is that so? (I tried disabling list scrolling with isVerticalScrollBarEnabled, but it didn't make any difference.)
EDIT: Now, as I switched order of the button and the list, I found out that I am scrolling ListView, not ScrollView, so the issue is I need to do scrolling of ScrollView, not ListView. How to do that?
CodePudding user response:
So I found out that ListView in a ScrollView is a bad practice, I used ListView footer feature instead, having button in the seperate layout, then adding it through code. It works perfectly.