I have created a merged control that contains a button named "btnSearch". I use this control using include tag in 2 places of an activity.
<include android:layout_width="wrap_content" android:id="@+id/include1"
android:layout_height="wrap_content" layout="@layout/inc_grouping"></include>
<include android:layout_width="wr开发者_开发百科ap_content" android:id="@+id/include2"
android:layout_height="wrap_content" layout="@layout/inc_grouping"></include>
When I use method this.findViewById(R.id.btnSearch) it returns only the first button. How can I get the second button?
Thanks,
this is inc_grouping.xml:
<?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:gravity="right"
android:background="@drawable/border01">
<LinearLayout android:id="@+id/linearLayout2"
android:layout_height="fill_parent" android:gravity="right"
android:layout_width="fill_parent">
<EditText android:layout_height="wrap_content" android:text="EditText"
android:layout_width="wrap_content" android:layout_weight="0.8"
android:id="@+id/edtSearchInclude"></EditText>
<ImageButton android:src="@drawable/search03"
android:layout_height="50dip" android:layout_width="50dip"
android:scaleType="centerInside" android:id="@+id/btnSearchInclude"></ImageButton>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout3"
android:layout_width="wrap_content" android:orientation="vertical"
android:layout_height="150dip">
<ListView android:layout_height="fill_parent"
android:scrollbarStyle="insideInset" android:layout_width="200dip"
android:id="@+id/lstInclude"></ListView>
</LinearLayout>
</LinearLayout> </merge>
精彩评论