[英]Change action bar to transparent color to work on both Android 2 and Android 3
I get this nice piece of code from http://developer.android.com/resources/samples/ActionBarCompat/index.html , which able to make ActionBar
GUI on both Android 2 and Android 3 platform. 我从http://developer.android.com/resources/samples/ActionBarCompat/index.html获得了这段不错的代码,它能够在Android 2和Android 3平台上制作
ActionBar
GUI。
However, I was wondering, had anyone tried to change the color of ActionBar
. 但是,我想知道,是否有人尝试更改
ActionBar
的颜色。 Note that, the following code will make crash at Android 2, as in Android 2, it doesn't have ActionBar
. 请注意,以下代码将在Android 2上崩溃,因为在Android 2中,它没有
ActionBar
。
public void onCreate(Bundle savedInstanceState) {
...
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ad_action_bar_gradient_bak));
}
使用ActionBarSherlock就像魅力一样:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.