私は断片に対して1つの活性を有する。私はレイアウトを縦向きにするレイアウトと、横向きに並べるレイアウトにする方法を知らない。 2つのレイアウトを作成し、 "onCreate"メソッドでオリエンテーションをチェックし、適切なものをレンダリングする必要がありますか?レイアウトを違うように設定する必要がありますか? (今のところ、縦長ビューではOKですが、横長ビューでは重なっています)。ここで 2つの断片が画面上で異なることを示すアクティビティ
は私のレイアウトです:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.apps.rucsi.biorhytm.MainActivity">
<fragment android:name="com.apps.rucsi.biorhytm.InputFragment"
android:id="@+id/inputFragment"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<fragment android:name="com.apps.rucsi.biorhytm.OutputFragment"
android:id="@+id/outputFragment"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
さて、私はそれらをLinearLayoutに入れました。縦向きに縦向き、横向きに横向きを設定しました。それはOKですが、これには2つのレイアウト(例:layoutとlayout_land)を使用する必要がありますか?私は両方の状況に合わせて1つのレイアウトを作る方法を理解できません。 – Rucsi
あなたは垂直方向のみが必要です。あなたがあなたの携帯電話を回転させると「上がっている」ものも変化するので、これは別のlayout_landを必要としません。 – jbarat
はい、私は下のグラフを望んでいませんが、私はそれをフォームの右側に入れます。垂直方向では、それを下に横に整列させます。私が何かを見逃してしまったのは残念ですが、私はAndroid開発で非常に新しいです。あなたの答えをありがとう! – Rucsi