How can I create a custom widget composite of android widget

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How can I create a custom widget composite of android widget

Postby silverburgh.meryl » Thu Feb 26, 2009 12:42 am

Hi,

I have read the LabelView example in APIDemo which show how to create a custom widget.

However, what if I want to create a custom widget which is a composite of existing android widget?

For example, in my currently activity, I have this in my layout xml file which has 2 bottoms left, right aligned:

<RelativeLayout
android:id="@+id/arow"
android:gravity="left"
android:layout_width="fill_parent"
android:layout_height="50px"
android:orientation="horizontal"
android:background="#000000"
android:layout_alignParentTop="true">

<ImageView
android:id="@+id/left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/left"
/>

<ImageView
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/right"
/>

</RelativeLayout>

My question is how can i create a custom widget which is a composite widget of 2 ImageView , with left, right aligned?

I know my custom widget need to be inherited from view, but if i do that, I can't do 'setContentView()' in my custom widget class (since that is an Activity method).

so how can I apply the above xml to my custom widget class?

Thank you.
silverburgh.meryl
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sun Feb 08, 2009 11:17 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests