android - onListItemClick not working in a ListFragment placed in an activity -
i have standard activity has listfragment "embedded" layout through xml. listfragment defined custom adapter.
though, list gets populated, i'm unable click on list items; click not getting registered @ all. list item layout has 2 textviews in it.
here code listfragment code:
public class alarmlist extends listfragment { public void oncreate(bundle icicle) { super.oncreate(icicle); string[] values = new string[] { "android", "iphone", "windowsmobile", "blackberry", "webos", "ubuntu", "windows7", "max os x", "linux", "os/2" }; // utilize custom layout alarmlistcustomadapter adapter = new alarmlistcustomadapter(getactivity(), values, "fonts/lato-light.ttf"); setlistadapter(adapter); } @override public void onlistitemclick(listview l, view v, int position, long id) { log.i("checking: ", "working"); string item = (string) getlistadapter().getitem(position); toast.maketext(getactivity(), item + " selected", toast.length_long).show(); } } here layout of list element:
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:scrollbars="none" android:background="#dfdfdf" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:focusable="false"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="#fbfbfb" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margintop="5dp" android:layout_marginleft="6dp" android:layout_marginright="6dp" android:paddingbottom="14dp" android:paddingtop="14dp" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" > <textview android:id="@+id/alarm_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/wall_clock_hint" android:textsize="25sp" android:layout_alignparentleft="true" android:focusable="false" android:focusableintouchmode="false"/> <textview android:id="@+id/alarm_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/alarm_time" android:layout_margintop="8dp" android:textsize="15sp" android:focusable="false" android:focusableintouchmode="false" android:hint="label"/> </relativelayout> <view android:layout_marginleft="10dp" android:layout_marginright="10dp" android:layout_width="fill_parent" android:layout_height="5dip" android:background="@drawable/drop_shadow"> </view> </linearlayout> </scrollview> what wrong here?
i have gone through similar questions on so, none of solutions worked me.
don't embed scrollable widgets scrollview(from row layout) in scrollable widget listview.
android android-fragments android-listfragment
No comments:
Post a Comment