나는 사용자 정의 어댑터가 ListView
입니다. 그것은 CheckBoxes를 계산합니다. 그 중 하나가 점검 될 때, 나는 다른 것들을 체크하지 않도록하고 싶습니다. CheckBox
목록을 만든 다음이 목록을 반환하는 메서드를 만들었지 만 IndexOutOfBounds를 계속 유지했습니다 (getBox 메서드의 목록에 CheckBox를 추가했습니다).안드로이드리스트 체크 박스 체크 박스
는 XML :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox android:id="@+id/checkBoxListView"
android:layout_height="50px"
android:layout_width="50px"/>
<EditText android:id="@+id/editTxtListView"
android:layout_height="50px"
android:layout_width="680px"
android:editable="false"
android:focusable="false" />
이 경우 작동하는 경우 어댑터 작동 방식을 이해하지 못했습니다. 어떤 경우에 getView 메소드가 호출됩니까? –
get view는 현재 화면에 표시되어있는 목록보기의 모든 행에 대해 호출됩니다. 그래서 만약 index = 2에서 상자를 체크했다면, getView는 index = 0에서 list length로 호출 될 것이고, 2 번째 위치에서만 checked가 체크 표시가 그려지기 때문에 다른 것들은 box가 그려 질 것입니다. 다음과 같이 어댑터에 대한 이해를 돕기 위해 http://developer.android.com/reference/android/widget/Adapter.html 및 http://www.vogella.de/articles/AndroidListView/article.html – akkilis
I 시도했지만,이 작동하지 않았다 .. 어쩌면 내가 뭔가 잘못하고 있어요. 내가 어떻게해야 할지를 생각할 수 없기 때문에 나는 @ Pastebin 코드를 게시했다. http://pastebin.com/iAdJJ6tg –