AdapterView.OnItemClickListener itemList1_itemclick_listenter1 = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView adapterView, View view, int arg2,
long arg3) { TextView textView = (TextView) view.findViewById(R.id.title);
textView.setTextColor(0xff8e8e8e);
Global.current_wenzhang = wenzhangList1.get(arg2);
setTitle(arg2 + "" + Global.current_wenzhang.getTitle()); try {
startActivity(new Intent(main.this, content.class));
} catch (Exception e) {
setTitle(e.getMessage());
}
}
};有10个item;
我点击第1个item变色之后; 第7个也变色了;
点击“查看后10条”后;第13个也变色;查不到原因啊 悲剧~~~
public void onItemClick(AdapterView adapterView, View view, int arg2,
long arg3) { TextView textView = (TextView) view.findViewById(R.id.title);
textView.setTextColor(0xff8e8e8e);
Global.current_wenzhang = wenzhangList1.get(arg2);
setTitle(arg2 + "" + Global.current_wenzhang.getTitle()); try {
startActivity(new Intent(main.this, content.class));
} catch (Exception e) {
setTitle(e.getMessage());
}
}
};有10个item;
我点击第1个item变色之后; 第7个也变色了;
点击“查看后10条”后;第13个也变色;查不到原因啊 悲剧~~~
上个APP一样的用法,悲剧~~~~~~~~~~~~~~~~
如果是不在同一页的,这个情况是正常的如果在同一个页面内,2个同时变色,应该不会吧
我在item里加入checkbox,选中第一个,滑动list,每隔7个被选中。
和楼主问题很相似。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true">
<shape>
<gradient android:startColor="#39a1c2" android:endColor="#39a1c2"
android:angle="0" />
</shape>
</item>
<item android:state_selected="true">
<shape>
<gradient android:startColor="#ffc2b7" android:endColor="#ffc200"
android:angle="270" />
</shape>
</item>
<item android:drawable="@drawable/listview_item_bk"> </item></selector>
然后,在item_of_list.xml中(listview的每个item的布局文件)中,
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"
android:background="@drawable/xb_listview_item_bk"
>
。item elements.......
</linerlayout>