[英]How To change Background color of Action Bar sherlock Spinner DropDown Dynamically?
I am using sherlock activity
bar spinner dropdown for my app and i would like to change the background color as now i am getting same color as default. 我正在为我的应用程序使用
sherlock activity
栏微调框下拉菜单,并且我想更改背景颜色,因为现在我的颜色与默认设置相同。 I am Using 我在用
final String[] actions = new String[] { "WorkArea", "project1","project2", "project3" };
and 和
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(),R.layout.sherlock_spinner_item, actions); getSupportActionBar().setNavigationMode(com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_LIST);
ActionBar.OnNavigationListener navigationListener = new OnNavigationListener() {
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
Toast.makeText(getBaseContext(), "Current Action : "actions[itemPosition],Toast.LENGTH_SHORT).show();
return false;
} };
getSupportActionBar().setListNavigationCallbacks(adapter, navigationListener);
adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
I am getting like 我越来越喜欢
I want like
我想要
can i change the background color here ?? 我可以在这里更改背景颜色吗? If Yes, Any Suggestion Please.
如果是,请提出任何建议。 Thank you
谢谢
Did you try to change your theme ? 您是否尝试过更改主题?
In your manifest file, set your theme with the following : 在清单文件中,使用以下命令设置主题:
<application android:theme="@style/Sherlock.__Theme.DarkActionBar">
You can create your own actionbar style easily by using a web generator like Action bar style generator 您可以使用网络生成器(如“动作栏样式生成器”)轻松地创建自己的动作栏样式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.