I have the following layout (for brevity sake, I removed the different attributes):
<RelativeLayout>
<LinearLayout>
<android.support.v7.widget.Toolbar/>
<LinearLayout android:id="@+id/item1"/>
<LinearLayout android:id="@+id/item2"/>
<LinearLayout android:id="@+id/item3"/>
<ListView/>
</LinearLayout>
<android.support.design.widget.FloatingActionButton/>
</RelativeLayout>
I am trying to get this whole page to be scrollable. At the moment, only the ListView scrolls. Any idea how to do? Note that I cannot use ScrollView due to the fact that I embed a ListView. Also, the outer element must be RelativeLayout as I need the FloatingActionButton to be fixed regardless of scrolling.
Having a
ListViewinside aScrollViewwould cause you a lots of trouble. Instead leave only theListViewin your layoutand move your
LinearLayoutsinto separate file (for example header.xml)You can then add the layout as header to your
ListViewwithNow the whole view will be scrollable. If you use
onItemClickListenerdon't forget that the index is shifted bylistView.getHeaderViewsCount().