画面を2つに分割したいのですが、私はLinearLayout
を持っていて、再びLinearLayouts
を2つ含んでいます。Androidレイアウト課
これらの2つをどのように分割するのですか?LinearLayouts
は2つの等しい部分に分けられますか?
画面を2つに分割したいのですが、私はLinearLayout
を持っていて、再びLinearLayouts
を2つ含んでいます。Androidレイアウト課
これらの2つをどのように分割するのですか?LinearLayouts
は2つの等しい部分に分けられますか?
だけ追加します。それらの両方に
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
を。 layout_weight
パラメータが等しいと、スペースの量が均等に分散されます。
以前の質問に対する回答の一部を受け入れることに取り組んでください。
この例が役立つかどうかを確認してください。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/rootlinearlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/linearlayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/et01"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="First TextBox"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearlayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="@+id/et02"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Another TextBox"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
こんにちは、返信ありがとう、私は2つに垂直に画面を分割したい、私はあなたのコードを使用して、 "AnotherTextbox"は非常に最初のテキストボックスの後に来て、私は50%最初と50 2番目の提案に何か提案がありますか? – ramsbh
両方のEditTextでandroid:layout_height = "match_parent"を試してみてください。これは正常に動作するはずです。 –
通常、私はアンドロイド:layout_weight = "1"を使用します。また、テーブルレイアウトを使用することもできます。
我々はフラグメント の両方のために android:layout_width="0dp"
と android:layout_weight="1"
を使用することができ、これらの親で、私たちは答えにご回答を読んandroid:layout_width="fill_parent"
を使用することができます。どうすれば分けたいのですか?縦に(重ねて積み重ねる)、横に積み重ねる(互いの側面に現れる)? – kishu27