这是我的XML代码。可扩展的listView不会重叠,但会在空间中向下推送内容,这会使布局看起来非常难看。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:clickable="true"
android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="wrap_content"
android:contentDescription="@string/logo"
android:src="@drawable/smart_kids_logo"
android:onClick="home" />
<TextView
android:clickable="true"
android:paddingLeft="@dimen/activity_vertical_margin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:paddingTop="@dimen/activity_vertical_margin"
android:text="@string/home"
android:onClick="home" />
<TextView
android:clickable="true"
android:paddingLeft="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:text="@string/about"
android:onClick="about" />
</LinearLayout>
<LinearLayout
android:baselineAligned="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<ExpandableListView
android:id="@+id/LDBasics"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>
<ExpandableListView
android:id="@+id/AgesStages"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>
<ExpandableListView
android:id="@+id/GuideToAction"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>
<ExpandableListView
android:id="@+id/ParentsCommunity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="10dp"
android:baselineAligned="false"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:layout_marginTop="60dp"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.3"
android:background="#83D6D4"
android:layout_marginLeft="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:text="@string/QuickLinks"
android:textSize="14sp" />
<TextView
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/NewToLD"
android:textSize="10sp" />
<TextView
android:clickable="true"
android:textSize="10sp"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dyslexia"/>
<TextView
android:clickable="true"
android:textSize="10sp"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/adhd"/>
<TextView
android:clickable="true"
android:textSize="10sp"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/nld"/>
<TextView
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/executiveFunction"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.7"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/logo"
android:src="@drawable/home_page_image"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/HomePageCaption"
android:textStyle="bold"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/HomePageText"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
当我展开listView时,它会将所有其他textView向下推,而不是重叠它们。 我该如何解决?我应该使用过度滚动属性吗?