material-components-android
material-components-android copied to clipboard
[ BottomNavigationView] The BottomNavigationView component takes up too much memory!
trafficstars
Description: After the component was declared in XML and referenced the menu, the memory increased by about 25-35MB! When I deleted the menu declaration, the memory returned to normal. also I checked the size of the menu icon and it is only a few dozen KB.
Expected behavior:
Source code:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
style="@style/Widget.Material3.BottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:backgroundTint="@android:color/transparent"
app:itemBackground="?attr/colorSurfaceContainer"
app:labelVisibilityMode="selected"
app:menu="@menu/main_container_bottom_menu" />
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/main_menu_homepage"
android:icon="@android:drawable/sym_action_chat"
android:title="chat"
app:showAsAction="always" />
<item
android:id="@+id/main_menu_discovery_comic"
android:icon="@android:drawable/sym_action_chat"
android:title="chat"
app:showAsAction="ifRoom" />
<item
android:id="@+id/main_menu_bookshelf"
android:icon="@android:drawable/sym_action_chat"
android:title="chat"
app:showAsAction="ifRoom" />
<item
android:id="@+id/main_menu_anime"
android:icon="@android:drawable/sym_action_chat"
android:title="chat"
app:showAsAction="ifRoom" />
</menu>
Minimal sample app repro: https://github.com/crowforkotlin/Issues-BottomNavigationView Android API version: 34 Material Library version: 1.12.0
Device: Xiaomi、Pixel6 API23