Hi All,
I need to size the top-most layout of my application dynamically (programmatically) based on information loaded from a configuration file.
Right now the in main.xml I have
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/background">
</LinearLayout>
So I am looking for a way to change android:layout_width and layout_height programmatically.
Any help would be appreciated
RM
EDIT:
As per suggestions I have tried the following:
LinearLayout l2 = (LinearLayout)findViewById(R.id.LinearLayout07);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT,1);
l2.setLayoutParams(params);
But that gives me the following error when running:
Thread [<3> main] (Suspended (exception ClassCastException))
FrameLayout.onLayout(boolean, int, int, int, int) line: 288
FrameLayout(View).layout(int, int, int, int) line: 6133
....