android - How to create a custom, clickable text view layout for ListViews? -
i'm wondering how create custom textview behaves identically simple_list_item_1 does? there can tweak how want. have created custom layout follows:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:layout_width="match_parent" android:layout_height="match_parent" android:textcolor="#3104b4" android:id="@+id/customlistviewfield" android:clickable="true" android:padding="10dp" android:textsize="30dp" android:enabled="true" android:textisselectable="true" /> </linearlayout>
but onclicklistener doesn't receive events. thought marking clickable job. else must do?
p.s. there anywhere can view source code android.r folders can see of implementations (such simple_list_item_1) myself?
i'm wondering how create custom textview behaves identically simple_list_item_1 does?
simple_list_item_1
responds listview's onitemclick()
adapter's onitemclicklistener
not individual textview's onclick
.
but onclicklistener doesn't receive events. thought marking clickable job. else must do?
its depends on code implementations, wrap custom listview row layout adapter , implement onitemclicklistener
listview.
like,
listview.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, final view view, int position, long id) { // list item click } });
Comments
Post a Comment