i have main layout, called doit_service_expandablelistview, , include second layout, called doit_service_list_group, main layout. second layout contains imagebutton. want call onclick event on imagebutton. in activity main layout inflated.
this how inflate main layout:
layoutinflater factory = layoutinflater.from(getparentactivity()); v = factory.inflate(r.layout.doit_service_expandablelistview, null); and how inflate second layout:
view doitgrouplayout = fragmentview.findviewbyid(r.id.doitgroupview); imagebutton editservice = (imagebutton) doitgrouplayout.findviewbyid(r.id.edit_service); editservice.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { log.d("on edit click: ", "test"); } }); this include tag inside of main layout:
<include layout="@layout/doit_service_list_group" android:id="@+id/doitgroupview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true"/> this problem: onclick event doesn't fire, meaning don't log
log.d("on edit click: ", "test");
in logcat output
can please me figure out problem here. in advance.
edit: doit_service_list_group.layout
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:descendantfocusability="blocksdescendants"> <imageview android:layout_width="40dp" android:layout_height="40dp" android:id="@+id/orgpic" android:background="#f2f2f2" android:layout_margintop="15dp" android:layout_marginleft="15dp" android:layout_marginbottom="15dp" android:layout_marginright="30dp" /> <textview android:id="@+id/serviceid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="15dp" android:textcolor="#00aeef" android:textstyle="bold" android:layout_below="@+id/orgpic" android:layout_alignleft="@+id/orgpic" android:layout_marginbottom="5dp"/> <textview android:id="@+id/servicename" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="18dp" android:singleline="true" android:textcolor="#00aeef" android:layout_marginbottom="10dp" android:layout_marginright="15dp" android:layout_torightof="@+id/orgpic" android:layout_aligntop="@+id/orgpic" android:includefontpadding="false" android:layout_toleftof="@+id/edit_service" android:layout_tostartof="@+id/edit_service" /> <textview android:id="@+id/creationdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="12dp" android:textcolor="#818181" android:layout_below="@+id/orgpic" android:layout_alignleft="@+id/orgpic" /> <textview android:id="@+id/servicedescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="15dp" android:layout_marginbottom="15dp" android:layout_marginright="15dp" android:textcolor="#818181" android:lines = "2" android:maxlines="2" android:ellipsize="end" android:layout_below="@+id/servicename" android:layout_alignleft="@+id/servicename" /> <textview android:id="@+id/creationdateexpanded" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="12dp" android:textcolor="#818181" android:layout_below="@+id/serviceid" android:layout_alignleft="@+id/orgpic" android:layout_marginbottom="5dp" /> <textview android:id="@+id/supplier" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="15dp" android:paddingbottom="5dp" android:paddingleft="10dp" android:singleline="true" android:textcolor="#818181" android:layout_below="@+id/creationdateexpanded" /> <textview android:id="@+id/customer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="15dp" android:paddingbottom="5dp" android:paddingleft="10dp" android:singleline="true" android:textcolor="#818181" android:layout_below="@+id/supplier" /> <textview android:id="@+id/divider" android:layout_width="fill_parent" android:layout_height="1dp" android:background="#cccccc" android:layout_below="@+id/creationdate" android:layout_margintop="15dp" /> <imagebutton android:id="@+id/edit_service" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_ab_search_grey" android:text="button" android:clickable="true" android:layout_margintop="15dp" android:layout_marginbottom="5dp" android:layout_marginleft="10dp" android:layout_marginright="15dp" android:background="?android:attr/selectableitembackground" android:layout_alignparentright="true" android:layout_alignparentend="true" /></relativelayout>
Comments
Post a Comment