Android 要使用提示自定义EditText属性吗

Android 要使用提示自定义EditText属性吗,android,android-edittext,android-textinputlayout,material-components,material-components-android,Android,Android Edittext,Android Textinputlayout,Material Components,Material Components Android,我对android移动开发和java还不熟悉。不知道有没有人能帮我解决这个问题 现在,我正在制作我的android应用程序的XML文件,并希望它具有如下所示的内容 它可以在没有java知识的情况下用XML文件制作吗?我只想在我的EditText属性中有固定的文本。在我的第一个应用程序中使用LinearLayout。我感谢任何帮助 使用API 28进行测试。这称为TextInputLayout.Read。演示示例 是的,有一个默认布局TextInputLayout和textInputItemTe

我对android移动开发和java还不熟悉。不知道有没有人能帮我解决这个问题

现在,我正在制作我的android应用程序的XML文件,并希望它具有如下所示的内容

它可以在没有java知识的情况下用XML文件制作吗?我只想在我的
EditText
属性中有固定的文本。在我的第一个应用程序中使用
LinearLayout
。我感谢任何帮助


使用API 28进行测试。

这称为TextInputLayout.Read。演示示例


是的,有一个默认布局
TextInputLayout
textInputItemText
。 以下是文档:

您正在查找组件:

  <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Username"
        app:boxBackgroundColor="@color/white"
        app:boxStrokeColor="@color/text_input_layout_stroke_color"
        app:counterMaxLength="15"
        app:counterEnabled="true"
        >

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />

    </com.google.android.material.textfield.TextInputLayout>


是什么阻止了你这么做?XML和Java是两种不同的东西,您将了解一些教程,欢迎使用stackoverflow.com谢谢。我是移动安卓开发的新手,我还有一大堆其他问题要问。
  <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Username"
        app:boxBackgroundColor="@color/white"
        app:boxStrokeColor="@color/text_input_layout_stroke_color"
        app:counterMaxLength="15"
        app:counterEnabled="true"
        >

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />

    </com.google.android.material.textfield.TextInputLayout>