5
私は相対レイアウト、すなわちmain.xmlを以下のように設定しました。しかし今、私はview2に幅= 200dpと高さ= 100dpとview2を入れなければなりません。そうすれば、view2は大きなものになり、view1は小さなものになります。相対的なレイアウトをプログラム的に変更する
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/MainPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/panel_bottom"
android:layout_gravity="center_horizontal" >
<com.proj.demo.view1
android:id="@+id/sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignWithParentIfMissing="true"
android:layout_centerInParent="true"
android:layout_toLeftOf="@+id/panel_quick_buttons"
/>
<com.proj.demo.view2
android:id="@+id/sheet2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignWithParentIfMissing="true"
android:layout_centerInParent="true"
android:layout_toLeftOf="@+id/panel_quick_buttons"
/>
</RelativeLayout>
</RelativeLayout>
を入力し、その後にrlからinvalidate()を呼び出します。 –
ありがとう、それは私のために完璧に働いた。 – user1400285
rl.invalidate()を呼び出すと何も起こりません。しかし、私は画面をスクロールした後に変更されます。とにかくスクリード全体をリフレッシュするには? –