gauravk95 / bubble-navigation

🎉 [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.
Apache License 2.0
1.77k stars 211 forks source link

bt_icon not changing on state changed. #22

Open desaichirag06 opened 5 years ago

desaichirag06 commented 5 years ago

I am trying to change Icon of selected tab based on selection but not able to change it.

I am using Selector to switch the icons. Icons do not support vector images (SVGs) below API level 23.

Use in activitymain.xml

 <com.gauravk.bubblenavigation.BubbleToggleView
                android:id="@+id/tab_home"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:bt_active="true"
                app:bt_badgeTextColor="@color/darkPurple"
                app:bt_colorActive="@color/darkPurple"
                app:bt_colorInactive="@color/light_black"
                app:bt_icon="@drawable/home_tab_selector"
                app:bt_padding="10dp"
                app:bt_shape="@drawable/background_stroke"
                app:bt_title="@string/home_tab"
                app:bt_titleSize="12dp"/>

Selector: home_tab_selector.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/icon1" android:state_active="true" />
    <item android:drawable="@drawable/icon2" android:state_active="false" />

</selector>

Moreover, elevation is not working as it should. Also not getting the Shadow effect.

Is there any other way to do so? Please let me know.

Thanks.

issacNabil commented 1 year ago

+1