码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2015-04-13 16:09:10      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:

 

 

技术分享

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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>

 

 

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

技术分享

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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没有此属性

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

 技术分享

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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没有此属性

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

 

技术分享

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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没有此属性

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

 

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

标签:

原文地址:http://www.cnblogs.com/childhooding/p/4422232.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!