linearlayout不会显示所有子项 [英] linearlayout doesn't show all childs
本文介绍了linearlayout不会显示所有子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在此布局中存在问题:在listView之后没有显示任何子项 列表视图填补了这种景象;它滚动但没有显示其他任何孩子
I have problem in this layout that : it doesn't show any child after the listView and the listview is filling this sight ; it scrolls but didn't show the any other child
我曾尝试使用ScrollView,但它使expandlist出现问题
I have tried to user ScrollView but it make issues with expandlist
这是布局xml代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/select_bg"
android:orientation="vertical" >
<TextView
android:id="@+id/Header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/header_bg"
android:gravity="center"
android:paddingRight="50dip"
android:paddingTop="5dip"
android:text="@string/select"
android:textColor="#60240a"
android:textSize="18dip"
android:textStyle="bold" >
</TextView>
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent"
android:divider="@drawable/line_divider"
android:dividerHeight="3dip"
android:listSelector="@android:color/transparent" >
</ListView>
<ImageView
android:layout_width="fill_parent"
android:layout_height="3dip"
android:src="@drawable/line_divider" />
<ExpandableListView
android:id="@+id/expandableList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent"
android:childDivider="@drawable/line_divider"
android:divider="@drawable/line_divider"
android:dividerHeight="2dip"
android:listSelector="@android:color/transparent"
android:textColor="#60240a" >
</ExpandableListView>
</LinearLayout>
推荐答案
在布局中使用ListView
时,必须为列表视图添加此属性android:layout_weight
.如果未设置此属性,则无法获取所有视图.
When you are using ListView
in the layout you have to add this property android:layout_weight
for the listview. Without this property being set, you cannot get all views.
这篇关于linearlayout不会显示所有子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文