리스트뷰에 심플커서어댑터로 주소록을 띄웠습니다.(주소록정보는 지웟습니다.)
listactivity를 사용 하여 리스트뷰를 띄우고
여러명을 선택 하기 위래 체크박스를 추가 했습니다.
값을 가져오기 위해 체크한 부분에서 정보를 가져오는거 까진 잘 했는데요.
그런데 상단에 체크를 하고
스크롤을 내려서 보면
스크롤 내린곳에도 체크가 되어 있는데요
검색해보니
focusable=false로 하라고 해서 해봤는데 안되서요
이걸 따로 분리해서 감지 하는 방법이 없을까요?
소스
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dining_together_adjustment3);
// 인텐트 값 가져오기
get_intent_value = getIntent();
cursor = managedQuery(Phone.CONTENT_URI, new String[] { Phone._ID,
Phone.DISPLAY_NAME, Phone.NUMBER }, null, null,
Phone.DISPLAY_NAME + " asc");
if (cursor.moveToFirst() == false) {
return;
}
mArrayList.add(" " + cursor.getString(1) + " - " + cursor.getString(2));
while (cursor.moveToNext()) {
mArrayList.add(cursor.getString(1) + " - " + cursor.getString(2));
}
this.isCheckedConfrim = new boolean[mArrayList.size()];
startManagingCursor(cursor);
cols = new String[] { Phone.DISPLAY_NAME, Phone.NUMBER };
names = new int[] { R.id.row_tv_name, R.id.row_tv_number };
adapter = new SimpleCursorAdapter(this,
R.layout.contact_muit_check_list_item, cursor, cols, names);
this.setListAdapter(adapter);
listView = getListView();
listView.setItemsCanFocus(false);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
Button Borrow_money_the_former_button_ok = (Button) findViewById(R.id.Borrow_money_the_former_button_ok);
Borrow_money_the_former_button_ok
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
contact_muit_check_list_item. xml 입니다.
<?xml version="1.0" encoding="utf-8"?>
<!-- 이 파일은 /res/layout/listview.xml이다. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout_contact_muit_check_list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false" >
<CheckBox
android:id="@+id/row_chbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:focusable="false" />
<TextView
android:id="@+id/row_tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/row_chbox"
android:background="#ffffff" />
<TextView
android:id="@+id/gap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/row_tv_name"
android:background="#bcbcff" />
<TextView
android:id="@+id/row_tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/gap"
android:background="#bccbff" />
</RelativeLayout>
왜 체크가 상단과 스크롤후의 아래에도 같이 체크가 될까요;;;
setChoiceMode가 적용이 안된건지 ..
따르 각자 동작 하는 방법이 없을까요?
이미지는 이렇습니다. (상단에 4개를 체크하고 스크롤을 내리니 4개중 2개가 보이는겁니다.)
