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个也变色;查不到原因啊 悲剧~~~

解决方案 »

  1.   

    调试了N遍 还是无解;
    上个APP一样的用法,悲剧~~~~~~~~~~~~~~~~
      

  2.   

    你的2个item是不是不在同一页?
    如果是不在同一页的,这个情况是正常的如果在同一个页面内,2个同时变色,应该不会吧
      

  3.   

    标注一下,
    我在item里加入checkbox,选中第一个,滑动list,每隔7个被选中。
    和楼主问题很相似。
      

  4.   

      用long 类型个 arg3    arg2 是listview显示的序号 不能用了做 get的参数, arg3才是item的id。  还有就是你的getview再仔细琢磨一下   自定义getview那块没处理好也容易出类似的显示内容和传递数据内容不一致的情况
      

  5.   

    res/drawable中建一文件,如bg.xml,内容如下:
    <?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>