Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ BottomNavigationView] The BottomNavigationView component takes up too much memory! #4243

Open
crowforkotlin opened this issue Jul 28, 2024 · 0 comments

Comments

@crowforkotlin
Copy link

crowforkotlin commented Jul 28, 2024

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:
image
image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants