この以下の問題の根本を見つけようとしていますが、これを解決できません。
これが私のコードです:
private ListView listViewRouteDownload;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.lyt_route_download);
listViewRouteDownload = (ListView) findViewById(R.id.listViewRouteDownload);
Object obj[]=routeDownloadHelper.routeInfo();
beatId = (String[]) obj[0];
beatName = (String[]) obj[1];
adapter = new ArrayAdapter<String>(RouteDownloadActivity.this, android.R.layout.simple_list_item_multiple_choice, beatName);
listViewRouteDownload.setAdapter(adapter);
listViewRouteDownload.setItemsCanFocus(false);
listViewRouteDownload.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
上記のコードのすべてが完全に機能しますが、 when I am selecting choices on by clicking on checkbox my the other rows of the listview gets refreshed automatically.
はい、行が更新されていると言えます。例を参照してください。行に文字列 15 を配置した場合、他の行をクリックすると、リストビューが更新され、15 が 1 (and then below)
5になります。
これは、リストビューが初めて読み込まれたときのスクリーン ショットです。
そして、これがチェックボックスをクリックしたときのスクリーンショットです。
2 番目の画像では、22 が 2 2 になっていることがわかります(beolw that)
。
この問題を解決したい。
レイアウトファイルはこちら
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textViewRDTitle"
style="@style/HeadingTheme"
android:text="@string/route_sel" />
<View
android:id="@+id/viewLine1"
style="@style/horizontalImg"
android:layout_below="@id/textViewRDTitle" />
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:fadingEdge="none"
android:fillViewport="true"
android:scrollbars="none" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textViewBDRouteName"
style="@style/ListViewHeaderTheme"
android:gravity="center"
android:layout_width="230dp"
android:text="@string/route" />
<ImageView
android:id="@+id/imageViewselparator1"
style="@style/ListViewHeaderSeperatorEntry"
android:layout_height="30dp"
android:layout_toRightOf="@id/textViewBDRouteName" />
<TextView
android:id="@+id/textViewBDSelecct"
style="@style/ListViewHeaderTheme"
android:layout_width="87dp"
android:layout_toRightOf="@id/imageViewselparator1"
android:gravity="center"
android:text="@string/select" />
<ListView
android:id="@+id/listViewRouteDownload"
style="@style/ListViewTheme"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textViewBDRouteName"
android:background="@android:color/transparent" >
</ListView>
</RelativeLayout>
</HorizontalScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/button_bottom"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/buttonRDBack"
style="@style/styleNormalButton"
android:text="@string/back" />
<Button
android:id="@+id/buttonRDNext"
style="@style/styleNormalButton"
android:text="@string/next" />
</LinearLayout>
</LinearLayout>
どんな助けでも感謝します。
ありがとうございます。