根据所选的配置文件更改图标操作栏

时间:2013-04-25 09:29:40

标签: android icons android-actionbar profiles

我正在尝试在我的应用中实现ProfilesActivity。所以,想象一下,我们在home活​​动/布局中:UsersActivity,我们已经在其中执行了addActions来初始化操作栏,如:

Intent addProfilesIntent = new Intent(this, ProfilesActivity.class);
    Action profilesAction = (Action) new IntentAction(this, addProfilesIntent,
            R.drawable.go_profiles);
    actionBar.addAction(profilesAction);

我们点击操作栏上的个人资料图标,然后打开一个新的布局(profiles_menu.xml),其中我有一个带有可检查项目的listView和每个配置文件的图像(不同的配置文件:工作,家庭,辅助......)。

ListView list = (ListView) findViewById(R.id.list); 
ArrayList<HashMap<String, Object>> listData=new ArrayList<HashMap<String,Object>>();  
String []name={"    Company number","   Home number","   Handy number","   Auxiliary number"};  
for(int i=0;i<4;i++){  
    HashMap<String, Object> map=new HashMap<String, Object>();  
    map.put("number_image", R.drawable.icon+(i+1));  
    map.put("number_name", name[i]);  
    listData.add(map);  
}  
listItemAdapter = new CheckboxAdapter(this, listData);
list.setAdapter(listItemAdapter);  
list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

现在,我想要做的是:当我们选择一个配置文件时,它必须将主页操作栏上的配置文件图标(代码中的go_profiles)更改为所选的配置文件图标。你知道怎么做吗?

enter image description here

0 个答案:

没有答案
相关问题