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(R.id.view_container, 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?
jacko310592
Freshman
Freshman
 
Posts: 2
Joined: Sat Aug 06, 2011 11:52 am

Top

Return to General

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests