gpt4 book ai didi

java - 来自 Java 的提示更改错误

转载 作者:行者123 更新时间:2023-12-01 09:05:47 24 4
gpt4 key购买 nike

我有这样的布局:

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:textColorHint="@android:color/white">
<EditText android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:hint="Name" />
</android.support.design.widget.TextInputLayout>

我想在触摸开关按钮时更改 Java 的提示文本,但这就是使用此代码所发生的情况:

 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if (isTouched) {
isTouched = false;
if (isChecked) {
_nameText.setHint("Shop Name");
_inputPiva.setHint("ho la cacca");
}
else {
_nameText.setHint("Name");
}
}
}

enter image description here

enter image description here

如何设置类似浅蓝色的提示?

最佳答案

第1步:“编程”:editText.setHintTextColor(getResources().getColor(R.color.white));

第 2 步:“Xml”:android:textColorHint="#FFFFFF"

你可以像这样得到edittext的提示

    editText.setHint("My conditional hint");
final String str = hi.getHint().toString();

然后在切换 Onclick 监听器后放置代码

editText.setText(str); //It will replace the text 

关于java - 来自 Java 的提示更改错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41299032/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com