大佬教程收集整理的这篇文章主要介绍了Android AppCompat-v21工具栏动画,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
活动布局:
<include layout="@layout/toolbar_actionbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/actionbar_margin" />
工具栏布局:
<android.support.v7.widget.Toolbar xmlns:android="@R_489_10107@://scheR_4_11845@as.android.com/apk/res/android" xmlns:app="@R_489_10107@://scheR_4_11845@as.android.com/apk/res-auto" android:id="@+id/toolbarActionbar_T_actionToolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:BACkground="?attr/colorPriMary" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
活动Java:
actionToolbar = (Toolbar) findViewById(R.id.toolbarActionbar_T_actionToolbar); setSupportActionBar(actionToolbar);
截图:
除了使用hide()和show()方法外,对于动画,您必须这样做:
为了隐藏:
toolbarContainer.animate().translationY(-toolbarHeight).se@R_197_11520@terpolator(new AccelerateInterpolator(2)).start();
显示工具栏:
toolbarContainer.animate().translationY(0).se@R_197_11520@terpolator(new DecelerateInterpolator(2)).start();
为了进一步阅读,您可以参考这个tutorial.It谈论一个浮动动作按钮,但它与工具栏相同的动画.或者在GitHub找到它的代码.
你可以很容易地做到这一点,没有任何外部的图书馆.
以上是大佬教程为你收集整理的Android AppCompat-v21工具栏动画全部内容,希望文章能够帮你解决Android AppCompat-v21工具栏动画所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。