Динамическое изменение относительной ширины и высоты макета
Привет я использую следующую структуру макета внутри LinearLayout
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_con,tent" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="10dp"
android:textColor="#000" />
<TextView
android:id="@+id/tv2"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="right"
android:paddingRight="10dp"
android:textColor="#000" />
</TableRow>
</TableLayout>
<ImageView
android:id="@+id/img1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320px"
android:layout_height="320px"
android:gravity="center" >
</RelativeLayout>
и хотите установить относительную ширину и высоту макета динамически из файла Java вместо того, чтобы установить его равным 320px в файле XML, но не можем этого сделать, изменение ориентации не является проблемой, поскольку я ограничиваю его только в портретном режиме. Можно установить относительное расположение на весь экран с помощью match_parent, но я должен поставить другие виды на экран, чтобы это было возможно, или мне нужно добиться этого другим способом ...