Custom TextSize of BottomNavigationView support android

前端 未结 8 1209
别跟我提以往
别跟我提以往 2020-12-12 23:53

I am trying to change the textSize of BottomNavigationView from android support library 25.0.0



        
相关标签:
8条回答
  • 2020-12-13 00:34

    you can change it like this. you have to only khow the id of labels that google support used

    BottomNavigationView bottomNavigationView = (BottomNavigationView) fragmentActivity.findViewById(R.id.bottom_navigation);
        TextView textView = (TextView) bottomNavigationView.findViewById(R.id.menu_item_home).findViewById(R.id.largeLabel);
        textView.setTextSize(8);
    

    LargeLabel is the id of label that google used in its library

    0 讨论(0)
  • 2020-12-13 00:35

    Unfortunately this first version of BottomNavigationView came with a lot of limitations. And for now you can't change titles size just using the support design API. So to solve this limitation while google doesn't implement it, you can do:

    In your dimen.xml you can put:

        <dimen name="design_bottom_navigation_text_size" tools:override="true">30sp</dimen>
        <dimen name="design_bottom_navigation_active_text_size" tools:override="true">30sp</dimen>
    

    Doing this you are overriding the default value of dimen that the internal classes of BottomNavigationView use. So be carreful.

    0 讨论(0)
提交回复
热议问题