私はアンドロイドプログラミングに慣れていますが、documentationからレイアウトをどれだけ理解しているかによって、RelativeLayoutはほとんどの場合、いくつかのルールに基づいてビューが必要なときに使用され、FrameLayoutはビューをオーバーラップするときに使用されます。フレームと相対レイアウトの違いは?
残念ながら、次のプログラムでは、RelativeLayoutを使用してFrameLayoutの作業を行います。私は仕事を終わらせましたが、理解のために、違いに何かを見逃していますか? また、どのようにボタンが画像の上に来るのですか? (。でも、他の画像が重なっている)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_launcher"
/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
android:layout_alignParentTop="true"
android:layout_alignLeft="@id/imageView1"
/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1.0" >
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:text="Login" />
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:text="Register" />
<Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:text="Try application" />
</LinearLayout>
</RelativeLayout>
http://stackoverflow.com/a/4905403/1434631 – Nermeen