Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:ListView和TabWidget:ListView覆盖TabWidget_Android_Android Listview_Android Xml_Tabwidget_Android Tabs - Fatal编程技术网

Android:ListView和TabWidget:ListView覆盖TabWidget

Android:ListView和TabWidget:ListView覆盖TabWidget,android,android-listview,android-xml,tabwidget,android-tabs,Android,Android Listview,Android Xml,Tabwidget,Android Tabs,我在android项目中使用TabWidget,视图中有一个listView和一个FrameLayout。问题是,当ListView高于屏幕高度时,选项卡不可见,因为ListView覆盖了选项卡 我不知道如何在选项卡上方设置listView 以下是我的看法: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/androi

我在android项目中使用TabWidget,视图中有一个listView和一个FrameLayout。问题是,当ListView高于屏幕高度时,选项卡不可见,因为ListView覆盖了选项卡

我不知道如何在选项卡上方设置listView

以下是我的看法:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

    <FrameLayout
        android:id="@+id/frameLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="#ffffff"
        android:minHeight="44dp" >

    </FrameLayout>


    <ListView
        android:id="@+id/NewsCategorieslistView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:cacheColorHint="#00000000" 
        android:layout_below="@+id/frameLayout"
        >

    </ListView>

</RelativeLayout>
这是我的选项卡视图:

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

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

    </TabWidget>

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        >
    </FrameLayout>
</RelativeLayout>
</TabHost>
非常感谢。

为您的tab.xml选项卡活动的布局尝试此选项

<?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">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>
对于tab.xml选项卡活动的布局,请尝试此操作

<?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">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>

我找到了解决办法:

<?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_width="fill_parent" 
        android:layout_height="fill_parent">

        <FrameLayout android:id="@android:id/tabcontent"
             android:layout_width="fill_parent" 
             android:layout_height="fill_parent"
             android:layout_alignParentTop="true" 
             android:layout_above="@android:id/tabs" />

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

    </RelativeLayout>

</TabHost>

我找到了解决办法:

<?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_width="fill_parent" 
        android:layout_height="fill_parent">

        <FrameLayout android:id="@android:id/tabcontent"
             android:layout_width="fill_parent" 
             android:layout_height="fill_parent"
             android:layout_alignParentTop="true" 
             android:layout_above="@android:id/tabs" />

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

    </RelativeLayout>

</TabHost>

我在tab.xml中遇到了同样的问题。谢谢@android xx,我会立即发布。我在tab.xml中遇到了同样的问题。谢谢@android xx,我会立即发布。再次感谢@android xx,我现在上传了正确的xml。我尝试了你的例子,它的作品很好,除了标签是在顶部,我想有它在页面底部,没有页边空白。谢谢@android xx,我已经找到了解决方案并发布了答案。非常感谢您的帮助。再次感谢@android xx,我现在上传了正确的XML。我尝试了你的例子,它的作品很好,除了标签是在顶部,我想有它在页面底部,没有页边空白。谢谢@android xx,我已经找到了解决方案并发布了答案。非常感谢你的帮助。