How to associate a subclass with XML file?

Ainslietu

New Member
I have an XML file describing a dialog that contains a button, images, and text. In order to override the onClick and get it called for all the widgets in a dialog I wrote a subclass that extends RelativeLayout. Now I would like to associate the XML file with the subclass. Can I do it without using the inflater? \[code\] <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginTop="20dp" android:clickable="true" android:duplicateParentState="true" android:onClick="onClick" android:src="http://stackoverflow.com/questions/13751801/@drawable/ic_launcher" /> <EditText android:id="@+id/TextView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:layout_weight="1" android:duplicateParentState="true" android:ems="10" android:focusable="false" android:focusableInTouchMode="false" android:inputType="textMultiLine" android:text="text" > <requestFocus /> </EditText> </RelativeLayout>\[/code\]Thanks, Simon
 
Back
Top