由网友(朕要回幼儿园深造)分享简介:我读了很多关于ListSelector和选择。但我不能弄清楚如何为具有后不同颜色的的一个ListView项目它得到了pressed。 I read a lot about ListSelector and selectors. But i cant figure out how to have the Item of...
我读了很多关于ListSelector和选择。但我不能弄清楚如何为具有后不同颜色的的一个ListView项目它得到了pressed。
I read a lot about ListSelector and selectors. But i cant figure out how to have the Item of a ListView having a different color after it got pressed.
在双片段布局的ListView左用户点击,数据获取加载和$ P $在正确的片段psented。要随时了解其项目中选择,我想这是突出直到左ListView的下一个项目的用户获得pressed。
In a Dual Fragment Layout the User clicks in Left ListView, data get loaded and presented in the right Fragment. To Keep the User Informed which item selected i want this to be highlighted until next item in the Left ListView gets pressed.
我需要定制的国家吗?如何Gmail应用程序做到这一点?
Do i need a custom State there ? How does the GMail App do this ?
THX
推荐答案
我对Android解决方案> 1.6
My solution for Android > 1.6 is:
在活动:
public static int POS = -1;
...
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
...
POS = arg2;
...
}
在适配器:
public View getView(int position, View convertView, ViewGroup parent) {
...
int pos = MyActivity.POS;
if (pos == position){
convertView.setBackgroundResource(R.drawable.lv_yellow);
}else{
convertView.setBackgroundResource(R.drawable.lv_empty);
}
...
}
相关推荐
最新文章