クリック可能なリストアイテムの外観を再構築する必要があります。
したがって、私はこのxmlコードを持っています:
<?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="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/tv_changeRoomLabel"
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_optionChangeName" />
<include
android:id="@+id/tv_btn_changeRoom"
layout="@android:layout/simple_list_item_1"
android:background="@android:drawable/btn_default"
android:clickable="true" />
</LinearLayout>
タグに追加するためにさまざまなことを試しましたが、常に同じです。リストアイテムをクリックしても、フィードバックが表示されません。simple_list_itemの背景色は、通常のListViewを使用する場合のように変化しないことを意味します。それにもかかわらず、少なくともonClick()が実行されます。
何か案は?
PS simple_layout_activate_1に出くわしましたが、API 11なので、使用できません。私はmintarget7を持っています。
編集:javacode
TextView options = (TextView) findViewById(R.id.tv_btn_changeRoom);
options.setText(m_model.getRoomName(m_roomId));
options.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//do sth
}
});