Is it possible to use TransitionDrawable on the ActionBar?

我怕爱的太早我们不能终老 提交于 2019-12-06 03:05:48

Try it:

In values/string:

<color name="blue">#FF4682B4</color>
<color name="red">#FFC30F0F</color>

In your class:

ColorDrawable blue = new ColorDrawable(getResources().getColor(R.color.blue));
ColorDrawable red = new ColorDrawable(getResources().getColor(R.color.red));
ColorDrawable[] color = {blue, red}; 
TransitionDrawable trans = new TransitionDrawable(color);
actionBar.setBackgroundDrawable(trans);
trans.startTransition(500);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!