我实施了ExpandableListView
。但它的物品很长,并没有出现在屏幕上!
我用HorizantalScrollView
来解决这个问题。但它通过(标题)调整为最小化。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ExpandableListView
android:id="@+id/lstUploadList"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ExpandableListView>
</LinearLayout>
</HorizontalScrollView>
我该如何解决这个问题?
答案 0 :(得分:0)
您不需要水平滚动视图,因为您需要设置layout_height =“wrap_content”。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ExpandableListView
android:id="@+id/lstUploadList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ExpandableListView>
</LinearLayout>
或者如果要水平滚动布局,则必须将水平布局的宽度设置为wrap_content
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ExpandableListView
android:id="@+id/lstUploadList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ExpandableListView>
</LinearLayout>
</HorizontalScrollView>