在Android 5.0中,listview元组重叠底栏

时间:2015-02-23 12:30:47

标签: android android-layout listview android-listview

enter image description here

我的活动中有一个viewpager,它动态填充了片段。 片段包含一个列表视图,它导致问题,因为它与nexus 5.0中的底栏重叠(它可能是棒棒糖问题,因为它在其他设备上工作正常。)

包含viewpage的活动布局如下:

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="@dimen/view_label_min_height"
    android:background="@color/background_material_light"
    android:orientation="horizontal">

    <RelativeLayout
        android:id="@+id/notYetCalledTab"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/item_selected_background_drawable">

        <TextView
            android:id="@+id/notYetCalled"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:padding="8dp"
            android:text="No action taken"
            android:textColor="@color/textColor" />

        <View
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:layout_alignParentBottom="true"
            android:background="@drawable/tab_indicator_drawable" />

    </RelativeLayout>

    <View
        android:layout_width="0.5dp"
        android:layout_height="match_parent"
        android:background="@color/strokeColor" />

    <RelativeLayout
        android:id="@+id/todayTab"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/item_selected_background_drawable">

        <TextView
            android:id="@+id/today"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:padding="8dp"
            android:text="Today's"
            android:textColor="@color/textColor" />

        <View
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:layout_alignParentBottom="true"
            android:background="@drawable/tab_indicator_drawable" />


    </RelativeLayout>

    <View
        android:layout_width="0.5dp"
        android:layout_height="match_parent"
        android:background="@color/strokeColor" />

    <RelativeLayout
        android:id="@+id/pastTab"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/item_selected_background_drawable">

        <TextView
            android:id="@+id/past"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:padding="8dp"
            android:text="Past"
            android:textColor="@color/textColor" />

        <View
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:layout_alignParentBottom="true"
            android:background="@drawable/tab_indicator_drawable" />


    </RelativeLayout>

    <View
        android:layout_width="0.5dp"
        android:layout_height="match_parent"
        android:background="@color/strokeColor" />

    <RelativeLayout
        android:id="@+id/upcomingTab"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/item_selected_background_drawable">

        <TextView
            android:id="@+id/upcoming"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:padding="8dp"
            android:text="Upcoming"
            android:textColor="@color/textColor" />

        <View
            android:layout_width="match_parent"
            android:layout_height="3dp"
            android:layout_alignParentBottom="true"
            android:background="@drawable/tab_indicator_drawable" />


    </RelativeLayout>

</LinearLayout>

<View
    android:layout_width="match_parent"
    android:layout_height="0.5dp"
    android:background="@color/strokeColor" />

<android.support.v4.view.ViewPager
    android:id="@+id/viewPager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/background_material_light" />
</LinearLayout>

包含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="match_parent">

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:dividerHeight="8dp"
        android:divider="@android:color/transparent"
        android:padding="8dp"/>
</RelativeLayout>

请帮帮我。在此先感谢!!!

1 个答案:

答案 0 :(得分:0)

发现导航栏超出了您的布局,为避免这种情况,您需要调用窗口将其设置回来

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
相关问题