Layout weight on dynamically added RemoteViews

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Layout weight on dynamically added RemoteViews

Postby jacko310592 » Sat Sep 10, 2011 8:39 pm

Within my widget, i'm using the following to dynamically add items (R.layout.widget_item) to a LinearLayout defined within my main widget layout:

Code: Select all
//--  Main widget layout
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_design);

//--  Add to main layout
RemoteViews newView = new RemoteViews(context.getPackageName(), R.layout.widget_item);
views.addView(, newView);

My question is, how can I dynamically set the "android:layout_weight" attribute on the newView?

I've been told I need to be using setLayoutParams ..but I'm not sure how, so could someone provide an example please, or a better solution?
Posts: 2
Joined: Sat Aug 06, 2011 11:52 am


Return to General

Who is online

Users browsing this forum: No registered users and 5 guests