【发布时间】:2014-01-12 04:43:13
【问题描述】:
我有一个带有FrameLayout 的tabContent 的片段选项卡实现,如下所示:
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:id="@+id/tab_content_wrapper">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="0"
android:showDividers="none"
android:background="#434343"/>
</LinearLayout>
</TabHost>
然后在真实内容中,我可以添加ListView,它是可滚动的。但是,当我想让RelativeLayout 具有固定高度的内容并在其下方添加ListView 时,就会出现问题。它具有以下资源布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/some_content_with_listview"
android:orientation="vertical"
android:background="#ffffff">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:gravity="top"
android:paddingLeft="10dp"
android:paddingTop="7dp"
android:paddingRight="10dp"
android:id="@+id/pre_list_view_content"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp">
...
</RelativeLayout>
<ListView
android:id="@+id/my_list_view"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:smoothScrollbar="true">
</ListView>
</LinearLayout>
在AsyncTask 之后,my_list_view 填充了项目,并且它显示在非常短的可滚动ListView 中。我似乎无法使LinearLayout 更高以包含整个ListView 而无需滚动。所以澄清一下,我想让 ListView 不可滚动,但要使 LinearLayout 可滚动 在 realtabcontent (FrameLayout) 中
谢谢!
【问题讨论】:
标签: android listview android-listview android-asynctask android-linearlayout