Android bottom navigation bar customization

后端 未结 1 466
北海茫月
北海茫月 2021-02-10 22:13

I have successfully implementing simple bottom bar and it looks like picture 1. But I wanted to customize it further so it can looks like the bottom bar in Youtube\'s android ap

相关标签:
1条回答
  • 2021-02-10 22:28

    try this

    Custom color using Android Ripple Effect:

    Create button.xml in drawable folder

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@color/colorPrimaryDark"/>
    <item android:drawable="@color/colorPrimary"/>
    </selector>
    

    Create button.xml in drawable-v21 folder

    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="?android:colorControlHighlight">
    <item android:drawable="@color/colorPrimary" /> 
    </ripple>
    

    apply in your theme

     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorControlHighlight">@color/colorPrimaryDark</item>
    </style>
    

    now you can set button.xml as background of your view.

     android:background="@drawable/button"
    

    in case of any query follow this link

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