EditText主要用于输入框

属性

   1.android:inputType 输入类型(textPassword:密码, number:正整数 numberSigned 输入整数 numberDecimal小数)

  2.android:hint="password"输入提示语 

  3.android:maxLength="12" 表示输入字符串的长度

对整体的布局中的EditText做简要的修正

<?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\n 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"/>

    <!--
    android:inputType 输入类型
        textPassowrd 密码
        number 只能有正整数
        numberSigned 只能输入整数
        numberDecimal 小数
    -->

    <EditText
        android:layout_width="match_parent"
        android:layout_height="68dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="25dp"
        android:hint="Name and Surname"
        android:gravity="center"
        android:textColorHint="#cccccc"
        android:background="@mipmap/border"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="68dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="25dp"
        android:hint="Emial Address"
        android:gravity="center"
        android:textColorHint="#cccccc"
        android:background="@mipmap/border"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="68dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="25dp"
        android:hint="Phone"
        android:gravity="center"
        android:textColorHint="#cccccc"
        android:inputType="phone"
        android:background="@mipmap/border"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="68dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="25dp"
        android:hint="Password"
        android:gravity="center"
        android:textColorHint="#cccccc"
        android:inputType="textPassword"
        android:maxLength="12"
        android:background="@mipmap/border"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="68dp"
        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>

posted on 2021-03-11 00:56  python我的最爱  阅读(141)  评论(0编辑  收藏  举报