Это мой макет списка:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent" android:id="@+id/linearLayout1"
android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout2"
android:layout_height="fill_parent">
<CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content"
android:layout_height="wrap_content"></CheckBox>
</LinearLayout>
<LinearLayout android:layout_width="wrap_content" android:id="@+id/linearLayout3" android:layout_height="fill_parent" android:orientation="vertical">
<TextView android:text="TextView" android:id="@+id/row1" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<TextView android:text="TextView" android:id="@+id/row2" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Хотя у меня есть избыток макетов, все это - флажок и пара TextViews.Я хочу, чтобы каждый listItem был активным (например, перейти к другому назначению), но когда я нажимаю кнопку (УДАЛИТЬ КНОПКУ) в своей деятельности, я хочу иметь возможность показывать флажки и выбирать элементы для удаления и удалять его.Пример кода приветствуется.
Java-код:
adapter = new SimpleAdapter(this, painItems, R.layout.mylistlayout,
from, to);
listthings.setAdapter(adapter);
listthings.setOnItemClickListener(this);
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
Intent intent = new Intent(this, Item1.class);
intent.putExtra("com.painLogger.painLevel", painLevelString);
intent.putExtra("com.painLogger.painTime", timeOfPainString);
intent.putExtra("com.painLogger.treatment", textTreatmentString);
intent.putExtra("painLocation", painLocation);
startActivity(intent);
}