は、私は私のアプリのレイアウトをデザインしたい私はRelativeLayoutプロパティを使用しますか?画像に下記のように
が、IMは相対的なレイアウトに適用する性質があり、私のXMLコードの下に右のように行くされていないことである問題を取得イムcenterInParentプロパティを持つ水平ルーラーイメージとcenterInParentのプロパティを持つverticle rulerイメージです。両方のルーラーが正確な位置に来るようにしますが、子供を水平ルーラーまたは子toLeftOf verticleルーラーの上に置くと、グラフィカルビューとして表示されませんxmlファイルの中には、centerInParentを適用することによって、両方のルーラーが中心に来るが、それらの参照がエッジに残っている理由が示されます。その理由は、layout_aboveまたはlayoutチャイルズは、レイアウトの外に出_toLeftOf
私のXMLコード
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/title"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/icon_img"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dip"
android:layout_marginTop="2.5dip"
android:src="@drawable/smicon"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_toRightOf="@id/icon_img"
android:layout_marginTop="3dip"
android:text="Welcome To JEM"
android:textStyle="bold"
android:id="@+id/wcm_id"
android:textSize="18dip"
android:textColor="#FFFFFF"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/wcm_id"
android:layout_alignParentRight="true"
android:layout_marginRight="5dip"
android:text="APPS BY SAM"
android:id="@+id/app_by"
android:textSize="16dip"
android:textColor="#FFFFFF"
/>
</RelativeLayout>
<!-- This relative layout which is showing the main cross and icon around it -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/center_hr"
android:layout_centerInParent="true"
android:src="@drawable/horizontal"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/center_vr"
android:layout_centerInParent="true"
android:src="@drawable/verticle"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/center_hr"
android:layout_toLeftOf="@id/center_vr"
android:id="@+id/getuser"
android:src="@drawable/adduser"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/center_hr"
android:layout_toRightOf="@id/center_vr"
android:id="@+id/set"
android:src="@drawable/set"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/center_hr"
android:layout_toLeftOf="@id/center_vr"
android:id="@+id/get"
android:src="@drawable/get"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/center_hr"
android:layout_toRightOf="@id/center_vr"
android:id="@+id/ico"
android:src="@drawable/icon"
/>
</RelativeLayout>
</LinearLayout>
ので、みんながイメージ
に示したように、私はその下、右、上、LEFするために、このメインクロスやアイコンをachiveことができる方法を教えてください
+1いいです、他の人に役立ちます。 –