这是电子邮件的 .XML 代码,密码和其他字段也类似。
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/edittxt_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#f1f2f6"
android:hint="Email">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:background="@color/light_grey"
android:inputType="textEmailAddress"
android:typeface="sans" />
</com.google.android.material.textfield.TextInputLayout>
现在,我在这样的 Java 文件中使用它。即使我显示全名,它也会显示一些存储的 id 而不是实际名称。
fullname = (TextInputLayout) findViewById(R.id.editxt_fullname);
对于注册按钮点击,这就是我正在做的。
btnregister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = fullname.toString`btnregister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = fullname.toString();
();
当我显示用户只是为了查看它存储的内容时,它显示了一些 id,而不是用户名。问题是什么?首先,我得到了转换错误,现在我得到了无效的文本而不是我输入的文本