问题

I have a viewpager in my activity which is dynamically populated with fragments. Fragments contain a listview which is causing the issue as it overlaps the bottom bar in nexus 5.0 (It may be a Lollipop Issue as its working fine on other devices.)
The activity layout containing viewpage is as follows :
<?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>
And the layout of fragment that contains the listview is as follows :
<?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>
Please help me out . Thanks in advance !!!
回答1:
Found that the navigation bar gets ahead of your layout, to avoid this you need to call window to set it back
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
来源:https://stackoverflow.com/questions/28673882/in-android-5-0-listview-tuple-overlaps-bottom-bar