zoukankan      html  css  js  c++  java
  • RelativityLayout 子控件的几个常用的属性 android:layout_centerHorizontal="true"、 android:layout_centerVertical="true" 、android:layout_centerInParent="true"

    <?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没有此属性

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

  • 相关阅读:
    Java WebService入门实例
    Maven是什么
    for 循环
    2.4 DevOps工程师的故事:构建运行时的严谨性
    2.3.3 构建微服务的入口:Spring Boot控制器
    2.3.2 引导Spring Boot应用程序:编写引导类
    2.1.3 互相交流:定义服务接口
    第2章 使用Spring Boot构建微服务
    第1章 欢迎来到Cloud和Spring
    第一次在博客园开博
  • 原文地址:https://www.cnblogs.com/childhooding/p/4422232.html
Copyright © 2011-2022 走看看