<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".list1">
<ImageView
android:id="@+id/sinb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/left"
android:padding="10dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
/>
<ListView
android:layout_below="@id/sinb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView1"
android:layout_marginTop="30dp"
android:layout_centerHorizontal="true"
android:choiceMode="multipleChoice" />
<Button
android:id="@+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/listView1"
android:text="submit"/>
</RelativeLayout>
i have put these in Relative Layout..I have tried using ScrollView but it doesnt work . What i want is that a Submit button should be shown below Listview and when the list grows and goes offscreen the activity becomes scrollable and button should be shown below the end of listview.
For the behaviour you want, it will be better if you used a RecyclerView instead of a ListView and let it be inside a NestedScrollView, then enable nestedScrolling attribute on the RecyclerView. This way, you RecyclerView will behave like a long list and all views below it will only be visible after the list has been exhausted. Check the answers in this link to see how others implemented it.