Devlight / NavigationTabBar

Navigation tab bar with colorful interactions.
Apache License 2.0
4.95k stars 858 forks source link

A blinking issue occurs when changing the tab index. #90

Open greatsk55 opened 7 years ago

greatsk55 commented 7 years ago

tab.kt code :

models.add(
                NavigationTabBar.Model.Builder(
                        ContextCompat.getDrawable(this, R.drawable.and_general_bottom_bar_home_normal_bt),
                        ContextCompat.getColor(this, R.color.white))
                        .selectedIcon(ContextCompat.getDrawable(this, R.drawable.and_general_bottom_bar_home_active_bt))
                        .build()
        )
        models.add(
                NavigationTabBar.Model.Builder(
                        ContextCompat.getDrawable(this, R.drawable.and_general_bottom_bar_list_normal_bt),
                        ContextCompat.getColor(this, R.color.white))
                        .selectedIcon(ContextCompat.getDrawable(this, R.drawable.and_general_bottom_bar_list_active_bt))
                        .build()
        )

and xml code :

<devlight.io.library.ntb.NavigationTabBar
                android:id="@+id/ntb"
                android:layout_width="match_parent"
                android:layout_height="@dimen/tab_height"
                android:background="@drawable/and_bottom_bar_navi_bg"
                app:ntb_badge_gravity="top"
                app:ntb_badge_position="right"
                app:ntb_badged="true"
                app:ntb_bg_color="@color/white"
                app:ntb_icon_size_fraction="0.75"
                app:ntb_scaled="false"
                app:ntb_tinted="false"
                app:ntb_swiped="true"
                app:ntb_titled="false"/>

When I run the above code, whenever I change the tab, the image changes from inactive to active, causing the flickering to occur. I think it looks awkward. Is there a way to fix it?

pwa54rus commented 6 years ago

I think, you mean fade animation between normal and selected icon state. Am i right? Try not use "selectedIcon" method. This way, fade animation doesn't start, but you will have only one icon state.

reza-khalafi commented 4 years ago

This library unusable because of this problem. when change to another button of tab bar image has flashing. Is there a way to fix it?

reza-khalafi commented 4 years ago

I think i found the solution finally. Just need to add this code to xml file like this:
app:ntb_animation_duration="0"