当前位置:编程学习 > wap >>

一个下拉的ActionBar 怎么能在进入的时候直接定位到某一项?

比如现在一个下拉ActionBar里面有AAA,BBB,CCC三项,怎么样才能在初始化的时候让第二项(BBB)处于选中的状态呢?
ActionBar所在的Activity这么初始化,基本就是直接生成的代码没改动

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Intent intent = getIntent();
int params = intent.getIntExtra("param", 0);
// Set up the action bar to show a dropdown list.
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

simpAdapter = new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
android.R.id.text1, new String[] {
getString(R.string.title_section1),
getString(R.string.title_section2),
getString(R.string.title_section3) });

// Set up the dropdown list navigation in the action bar.
actionBar.setListNavigationCallbacks(
simpAdapter, this);
}
--------------------编程问答-------------------- 自己顶! --------------------编程问答-------------------- 自己顶! --------------------编程问答-------------------- 自己顶啊顶啊顶
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,