RelativityLayout 子控件的几个常用的属性  android:layout_centerHorizontal="true"、 android:layout_centerVertical="true" 、android:layout_centerInParent="true"

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:andro
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_launcher" />
       
    </RelativeLayout>

</LinearLayout>

 

 

------------------------------------------------------------------------------------------

RelativityLayout 子控件的几个常用的属性  android:layout_centerHorizontal="true"、 android:layout_centerVertical="true" 、android:layout_centerInParent="true"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:andro
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:src="@drawable/ic_launcher" />

        <!--
           android:layout_centerVertical="true" 
           android:layout_centerInParent="true"

        -->

    </RelativeLayout>

</LinearLayout>

 

    android:layout_centerHorizontal="true"         RelativityLayout没有此属性

------------------------------------------------------------------------------------------

 RelativityLayout 子控件的几个常用的属性  android:layout_centerHorizontal="true"、 android:layout_centerVertical="true" 、android:layout_centerInParent="true"

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:andro
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
           android:layout_centerInParent="true"
            android:src="@drawable/ic_launcher" />

    </RelativeLayout>

</LinearLayout>

 

   android:layout_centerInParent="true"         RelativityLayout没有此属性

------------------------------------------------------------------------------------------

 

RelativityLayout 子控件的几个常用的属性  android:layout_centerHorizontal="true"、 android:layout_centerVertical="true" 、android:layout_centerInParent="true"

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:andro
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
           android:layout_centerVertical="true"
            android:src="@drawable/ic_launcher" />

    </RelativeLayout>

</LinearLayout>

 

   android:layout_centerVertical="true"        RelativityLayout没有此属性

------------------------------------------------------------------------------------------

 

相关文章: