我有一个底部导航视图,其中显示了所选项目的背景
下面是底部导航视图xml代码:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:itemBackground="@drawable/bottombar_item_bg"/>
我想删除显示在所选项目顶部的顶部填充,这样背景可以匹配底部条的高度
如果我理解您为真android:layout_height=“?attr/ActionBarsize”
这里您将height设置为50dp,所以尝试将height更改为android:layout_height=“35dp”或android:layout_height=“40dp”