하나의 목록보기를 만들었습니다.이 각 행에는 확인란과 텍스트가 들어 있습니다. 확인란에있는 텍스트를 목록에서 가져와야합니다. 그건 내가 확인란을 사용하여 목록에서 선택한 텍스트 값을 전달해야합니다. 리스트는 내가 모든 값을 통과해야이 경우안드로이드에서 목록의 확인란을 어떻게 선택 하시겠습니까?
같이
gatwayList = (ListView) findViewById(R.id.gatwaylist);
ArrayList<HashMap<String,String>> wholeDetailsList = new ArrayList<HashMap<String,String>>();
for (int i = 0; i < 5; i++)
{
HashMap<String, String> map = new HashMap<String, String>();
map.put("name", "Test+ i");
//map.put("address", wrap_address);
wholeDetailsList.add(map);
}
SimpleAdapter wholeDetailsAdapter = new SimpleAdapter(this,
wholeDetailsList, R.layout.gatway_row, new String[] {"name"}, new int[] {R.id.gatwayId});
gatwayList.setCacheColorHint(0);
gatwayList.setAdapter(wholeDetailsAdapter);
gatway_row.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<CheckBox
android:id="@+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4px"
android:layout_alignParentLeft="true"
android:layout_marginRight="10px" >
</CheckBox>
<TextView android:id="@+id/gatwayId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ffff"
android:textSize="18dip"
android:layout_marginTop="15dip"
android:layout_marginLeft="60dip"
android:textStyle="bold"
android:textColor="#000000"/>
</RelativeLayout>
:
이 내 코드입니다. 그렇지 않은 경우에만 값을 선택하십시오. 모든 의견은 인정 될 것입니다?
@AMRI : 위의 코드에서 "CHOICE_MODE_MULTIPLE"무엇. 또한 이것은 잘 작동하지 않습니다. 위에서 언급 한 것과 동일한 UI가 필요합니다. 또한 확인란을 사용자 정의해야합니다. 그래서 위의 코드 만 사용해야합니다. 위의 코드를 시도했지만 목록에서 아무 것도 선택할 수 없으므로 확인란을 선택할 수 없습니다. – Lakshmanan