Android基础-UI控件(整体简单介绍)

1.UI主要控件分为

   1. TextView 用于字体显示 

   2.ImageView 用于图片显示 

   3.EditText 用于文本输入显示

   4.button 用于按钮 

属性说明:

   android:background="@mipmap/bg" 用于设置背景 

    android:gravity="center_horizontal" 用于设置属性的位置 

    android:layout_marginTop="70dp" 用于表示与相邻控件的上边距距离

    android:visible 用于设置当前的控件是否可见 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@mipmap/bg"
    tools:context=".MainActivity"
    android:gravity="center_horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sign up"
        android:layout_marginTop="70dp"
        android:visibility="invisible"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Imooc Imooc Imooc Imooc
 Imooc Imooc"
        android:layout_margin="20dp"
        android:gravity="center_horizontal"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/add_photo"
        android:layout_margin="10dp"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="40dp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="40dp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="40dp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="40dp" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="20dp"
        android:layout_marginRight="30dp"
        android:background="@mipmap/btn"
        android:text="Register"
        app:backgroundTint="@color/teal_700" />



</LinearLayout>

原文地址:https://www.cnblogs.com/my-love-is-python/p/14515045.html