RelativeLayout params for main screen widget

88 views Asked by At

What's up guys! Here is an example of my layout xml:

<RelativeLayout
    android:id="@+id/conf_RLayoutMultiSize"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"  
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    >

    <ImageView
        android:id="@+id/widget_body"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:src="@drawable/transparent100" />

    <ImageView
        android:id="@+id/widget_scar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:src="@drawable/scar1" />
</RelativeLayout>

<ImageView
    android:id="@+id/widget_dial"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:src="@drawable/dial1" />
</RelativeLayout>

The question is - is it possible to change the conf_RLayoutMultiSize size through the code? I have the cofigurantion layout where I did it easy, but can't realise how to do it on manescreen vidget. I've tried this

  widgetView.setInt(R.id.conf_RLayoutMultiSize,"setLayoutParams",150+widgetBodySize); 

but it wasn't succesful

1

There are 1 answers

1
ucsunil On

You can do it as follows:

RelativeLayout rlay = (RelativeLayout) findViewById(R.id.conf_RLayoutMultiSize);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(value_width, value_height); // Set whatever parameters you want here
rlay.setLayoutParams(params); // Assign parameters to relative layout