0
点赞
收藏
分享

微信扫一扫

Android输入框里面的文字设置hint隐藏文字

醉东枫 2022-01-11 阅读 71
<?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">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="46dp"
        android:text="请输入账号"
        android:id="@+id/edittext1"
        android:textSize="20sp"
        android:background="#EDEDED"
        android:layout_marginTop="48dp"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="46dp"
        android:hint="请输入密码"
        android:id="@+id/edittext2"
        android:textSize="20sp"
        android:layout_marginTop="10dp"
        android:background="#EDEDED"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"/>
    <Button
        android:layout_width="match_parent"
        android:layout_height="46dp"
        android:text="登陆"
        android:id="@+id/register_button"
        android:textSize="16sp"
        android:layout_marginTop="20dp"
        android:background="@drawable/test"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"/>

</LinearLayout>

在这里插入图片描述
如上图的请输入账号和请输入密码两个操作是不一样的,一个是android:text=“请输入账号”,另一个是android:hint=“请输入密码”,前面那个输入的时候要删字才能输入,后面那个是不用删字就可以输入的了

举报

相关推荐

0 条评论