【发布时间】:2015-11-18 07:23:10
【问题描述】:
如果我有一个ListView,其布局如下,每个项目都有一个复选框,当我单击Button 时,如何在onClick() 方法中获取所有选中的项目?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:onClick="submitList"
/>
</RelativeLayout>
onClick() 方法:
public void submitList(View view) {
//
}
【问题讨论】:
-
到目前为止你尝试了什么?
标签: android android-layout android-intent android-activity android-xml