私はのLinearLayout変更相対的なレイアウトの幅と高さを動的
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<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ファイルから動的に相対的なレイアウトの幅と高さを設定したいのですこんにちは代わりにxmlファイルに320PXに設定するのが、それを行うことができません。オリエンテーションの変更は、ポートレートモードでのみ制限されるため、問題ではありません。それが可能であるか、私はそれを別の方法を達成するために持っている...
動的にあなたが返信用 – Neil
おかげで、作成したクラスからRelativeLayoutクラスを拡張し、onMeasureメソッドをオーバーライドする必要がありますが、私はすべてのものを試してみましたし、私がしようとしたとき、それは、クラスのキャスト例外を与えてレイアウト幅を設定するには動的に幅と高さを設定します。相対レイアウトには画像ビューとして他の子も含まれているので、私はView Groupとしてjavaファイルに入れますが、それを行うことはできません。 –
例外それは – Neil