タイトルで述べたように、私はListViewのOnItemClickイベントを取得していません
私のコード:
ListView listView1 = (ListView) findViewById(R.id.listView1);
listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Toast.makeText(SelectQuizActivity.this, "OnItemClick", Toast.LENGTH_LONG).show();
}
});
SimpleAdapter adapter = new SimpleAdapter(this, listView, R.layout.list_layout, new String[]{"topic","by","score"}, new int[]{R.id.textViewTopic,R.id.textViewTopicCreator,R.id.textViewScore});
listView1.setAdapter(adapter);
レイアウトXML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".SelectQuizActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/bg_dark_gradient_rev"
android:gravity="center_horizontal"
android:padding="20dp"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textStyle="bold"
android:typeface="sans" />
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:choiceMode="singleChoice"
android:clickable="true"
android:divider="@drawable/bg_light_gradient"
android:dividerHeight="1dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:listSelector="@drawable/list" >
</ListView>
</RelativeLayout>