在Android中的ListView 5.0元组重叠底栏 [英] In Android 5.0 listview tuple overlaps bottom bar
问题描述
我在我的活动是动态填充片段一viewpager。
片段含有这是造成这一问题的列表视图,因为它重叠承上启下5.0底部栏(这可能是一个棒棒糖问题作为其工作的罚款在其他设备上。)
包含的ViewPage的活动安排如下:
<?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:方向=垂直><的LinearLayout
机器人:layout_width =match_parent
机器人:layout_height =@扪/ view_label_min_height
机器人:背景=@彩色/ background_material_light
机器人:方向=横向> < RelativeLayout的
机器人:ID =@ + ID / notYetCalledTab
机器人:layout_width =0dp
机器人:layout_height =match_parent
机器人:layout_weight =1
机器人:背景=@绘制/ item_selected_background_drawable> <的TextView
机器人:ID =@ + ID / notYetCalled
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_centerInParent =真
机器人:比重=中心
机器人:填充=8DP
机器人:文字=不采取行动
机器人:文字颜色=@颜色/文字颜色/> <查看
机器人:layout_width =match_parent
机器人:layout_height =3DP
机器人:layout_alignParentBottom =真
机器人:背景=@绘制/ tab_indicator_drawable/> < / RelativeLayout的> <查看
机器人:layout_width =0.5dp
机器人:layout_height =match_parent
机器人:背景=@色/则strokeColor/> < RelativeLayout的
机器人:ID =@ + ID / todayTab
机器人:layout_width =0dp
机器人:layout_height =match_parent
机器人:layout_weight =1
机器人:背景=@绘制/ item_selected_background_drawable> <的TextView
机器人:ID =@ + ID /今天
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_centerInParent =真
机器人:比重=中心
机器人:填充=8DP
机器人:文本=今天的
机器人:文字颜色=@颜色/文字颜色/> <查看
机器人:layout_width =match_parent
机器人:layout_height =3DP
机器人:layout_alignParentBottom =真
机器人:背景=@绘制/ tab_indicator_drawable/>
< / RelativeLayout的> <查看
机器人:layout_width =0.5dp
机器人:layout_height =match_parent
机器人:背景=@色/则strokeColor/> < RelativeLayout的
机器人:ID =@ + ID / pastTab
机器人:layout_width =0dp
机器人:layout_height =match_parent
机器人:layout_weight =1
机器人:背景=@绘制/ item_selected_background_drawable> <的TextView
机器人:ID =@ + ID /过去
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_centerInParent =真
机器人:比重=中心
机器人:填充=8DP
机器人:文字=过去
机器人:文字颜色=@颜色/文字颜色/> <查看
机器人:layout_width =match_parent
机器人:layout_height =3DP
机器人:layout_alignParentBottom =真
机器人:背景=@绘制/ tab_indicator_drawable/>
< / RelativeLayout的> <查看
机器人:layout_width =0.5dp
机器人:layout_height =match_parent
机器人:背景=@色/则strokeColor/> < RelativeLayout的
机器人:ID =@ + ID / upcomingTab
机器人:layout_width =0dp
机器人:layout_height =match_parent
机器人:layout_weight =1
机器人:背景=@绘制/ item_selected_background_drawable> <的TextView
机器人:ID =@ + ID /即将推出的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_centerInParent =真
机器人:比重=中心
机器人:填充=8DP
机器人:文字=即将到来的
机器人:文字颜色=@颜色/文字颜色/> <查看
机器人:layout_width =match_parent
机器人:layout_height =3DP
机器人:layout_alignParentBottom =真
机器人:背景=@绘制/ tab_indicator_drawable/>
< / RelativeLayout的>< / LinearLayout中><查看
机器人:layout_width =match_parent
机器人:layout_height =0.5dp
机器人:背景=@色/则strokeColor/>< android.support.v4.view.ViewPager
机器人:ID =@ + ID / viewPager
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:背景=@色/ background_material_light/>
< / LinearLayout中>
和包含列表视图片段的布局如下:
<?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent> < ListView控件
机器人:ID =@ + ID /列表
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:dividerHeight =8DP
机器人:分=@机器人:彩色/透明
机器人:填充=8DP/>
< / RelativeLayout的>
请帮助我。在此先感谢!
研究发现,在导航栏获取布局的进取,为避免这种情况,你需要调用窗口设置回
<$p$p><$c$c>getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);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 !!!
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);
这篇关于在Android中的ListView 5.0元组重叠底栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!