Project to use the ScrollView combined with the GridView, there are a lot of problems, here first take the ListView to open brush. The effect you want to achieve is as follows:
But the effect of the implementation is as follows:
It crashed. The layout is like this:
<scrollview xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Match_ Parent " android:layout_height=" match_parent " > <listview android:id=" @+id/list_view " android:layout_width= "match_parent" android:layout_height= "wrap_content" > </ListView> </ScrollView>
Add the following properties to ScrollView:
Android:fillviewport= "true"
Run the interface is out, but the interface is not able to drag, the solution is to customize the ListView:
Package Com.example.uilistviewtest;import Android.content.context;import Android.util.attributeset;import Android.widget.listview;public class Mylistview extends Listview{public Mylistview (context context, AttributeSet attrs , int defstyleattr) {Super (context, attrs, defstyleattr);} Public Mylistview (context context, AttributeSet Attrs) {Super (context, attrs);} Public Mylistview (Context context) {super (context);} @Overrideprotected void onmeasure (int widthmeasurespec, int heightmeasurespec) {int expandspec = Measurespec.makemeasurespec (Integer.max_value >> 2, measurespec.at_most); Super.onmeasure (WidthMeasureSpec, EXPANDSPEC);}}
The new layout:
<scrollview xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Match_ Parent " android:layout_height=" match_parent " > <com.example.uilistviewtest.mylistview Android:id= "@+id/list_view" android:layout_width= "match_parent" android:layout_height= "Wrap_content" > </com.example.uilistviewtest.MyListView></ScrollView>
Run again and solve the problem.
The exchange can add me: 619189810
63ScrollView nested listview problems and how to solve them