Android 底部导航视图奇怪的内部视图
我尝试在Android 底部导航视图奇怪的内部视图,android,bottomnavigationview,Android,Bottomnavigationview,我尝试在BottomNavigationView上方添加阴影的自定义视图,但有一个问题 BottomNavigationView有两个间接子项-BottomNavigationMenuView和视图。后者的视图宽度为1dp,如上图底部导航视图所示。 因此,它在BottomNavigationView和我的自定义阴影之间留出了1dp的间隙 这是什么视图,如何避免 以下是布局图: <?xml version="1.0" encoding="utf-8"?> <RelativeLay
BottomNavigationView
上方添加阴影的自定义视图,但有一个问题
BottomNavigationView
有两个间接子项-BottomNavigationMenuView
和视图
。后者的视图
宽度为1dp,如上图底部导航视图
所示。
因此,它在BottomNavigationView
和我的自定义阴影之间留出了1dp的间隙
这是什么视图
,如何避免
以下是布局图:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottom_navigation" />
<View
android:id="@+id/bottom_shadow"
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_above="@+id/bottom_navigation"
android:background="@drawable/shadow" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="@menu/navigation" />
</RelativeLayout>
但是仍然很有趣,这个视图是什么?对于1dp差距,也许一个快速修复方法是设置android:layout\u marginBottom=“-1dp”
以基本上“强制”视图向下移动该差异。你有间接子项的代码吗?BottomNavigationView的源代码似乎没有使用备用的“视图”
你能添加屏幕快照并更新帖子吗。