单击其项目时,BottomNavigationView没有动画

时间:2018-01-16 14:09:07

标签: android

我已设置BEGIN TRANSACTION SELECT * FROM TableA SELECT @@TRANCOUNT COMMIT TRANSACTION ,如下所示:

BottomNavigationView

<android.support.design.widget.BottomNavigationView android:id="@+id/bottomNavigation" android:layout_width="0dp" android:layout_height="wrap_content" app:itemBackground="@color/colorPrimary" app:itemIconTint="@drawable/nav_item_color_state" app:itemTextColor="@drawable/nav_item_color_state" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:menu="@menu/bottom_navigation"></android.support.design.widget.BottomNavigationView> 上调用的函数:

BottomNavigationView

bottomNavigation.setOnNavigationItemSelectedListener(object: BottomNavigationView.OnNavigationItemSelectedListener { override fun onNavigationItemSelected(item: MenuItem): Boolean { return true } })

nav_item_color_state.xml

<?xml version="1.0" encoding="utf-8"?>

我已确认在模拟器和设备上都启用了动画。我看到的教程正在制作动画。我究竟做错了什么?点击<item android:color="@android:color/white" android:state_enabled="true"/> <item android:color="@color/colorPrimaryDark" android:state_enabled="false"/> 上的其中一个项目后,它突然移动,没有动画。

1 个答案:

答案 0 :(得分:0)

试试这个

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/menu_timeline_selected" android:state_checked="true" />
    <item android:drawable="@drawable/menu_timeline_selected" android:state_pressed="true" />
    <item android:drawable="@drawable/menu_timeline_selected" android:state_selected="true" />
    <item android:drawable="@drawable/menu_timeline_default" />
</selector>