选项卡布局内的Android可滚动视图

选项卡布局内的Android可滚动视图,android,android-layout,scrollview,expandablelistview,Android,Android Layout,Scrollview,Expandablelistview,我目前在android布局的选项卡中使用可滚动视图时遇到问题。视图在选项卡下方滚动,没有在选项卡布局中实现的可滚动视图,如下所示 当我在选项卡式布局中放置一个可滚动视图时,它会显示一个小的可滚动视图,该视图看起来有缺陷且不可用。如下所示 选项卡主机的代码如下所示 <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android

我目前在android布局的选项卡中使用可滚动视图时遇到问题。视图在选项卡下方滚动,没有在选项卡布局中实现的可滚动视图,如下所示

当我在选项卡式布局中放置一个可滚动视图时,它会显示一个小的可滚动视图,该视图看起来有缺陷且不可用。如下所示

选项卡主机的代码如下所示

<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:padding="5dp" />
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />        
</RelativeLayout>
</TabHost>
干杯,
Rmplanner

根据评论编辑:找到了替代解决方案(OP使用的解决方案)

滚动视图上使用
android:layout\u height=“fill\u parent”
。(或者,由于不推荐使用
fill\u parent
,请使用
android:layout\u height=“match\u parent”

首先,删除您的
滚动视图
,并用以下内容替换您的
相对视图

<RelativeLayout
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_above="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>


您好,感谢您的快速回复,但不幸的是,这并没有解决此问题。“滚动视图”仍然很小,无法与“填充”和“匹配”父视图一起使用。您是否可以编辑OP以显示如何在选项卡中包含
ScrollView
?似乎任何包含
ScrollView
的内容都可能使用
wrap\u content
。由于我对android非常陌生,我不确定您的问题,但我可以从您的问题中得到的信息是,您要求的是选项卡主机活动。如果是,我现在就编辑它;如果没有,请澄清您是否需要更多信息。如果您的问题是关于XML的。我已经提供了我在选项卡中使用的所有XML。由于选项卡是通过编程方式创建的,因此除了可扩展列表视图外,它没有任何其他内容。还可以将
ExpandableListView
切换为
android:layout\u height=“wrap\u content”
。这应该可以做到……为什么要将listview保存在linearlayout中,将listview保存在scrollview中。为什么不能只使用listview或listactivity?
public class TabbedMainActivity extends TabActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tab_main);

    TabHost tabHost = getTabHost();

    // Tab for todays meals
    TabSpec todaysSpec = tabHost.newTabSpec("Todays");
    //you could set icon here as well as title
    todaysSpec.setIndicator("Todays");
    Intent todaysIntent = new Intent(this, TodaysMealsActivity.class);
    todaysSpec.setContent(todaysIntent);

    // Tab for future meals
    TabSpec futureSpec = tabHost.newTabSpec("Future");
    futureSpec.setIndicator("Future");
    Intent futureIntent = new Intent(this, FutureMealsActivity.class);
    futureSpec.setContent(futureIntent);

    // Tab for comments
    TabSpec commentsSpec = tabHost.newTabSpec("Comments");
    commentsSpec.setIndicator("Feedback");
    Intent commentsIntent = new Intent(this, CommentsActivity.class);
    commentsSpec.setContent(commentsIntent);

    // Adding all TabSpec to TabHost
    tabHost.addTab(todaysSpec); // Adding todays tab
    tabHost.addTab(futureSpec); // Adding future tab
    tabHost.addTab(commentsSpec); // Adding comments tab
}
}
<RelativeLayout
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_above="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</RelativeLayout>