ここに二重ヒントの問題があります - TextInputLayout と EditText 二重ヒントの問題
私も同じことをする必要があります。2つのヒントが必要です。1 つは EditText のタイトルで、2 番目は何も入力されていない場合の値です。
残念ながら、タグは 1 つしかありません。
android:hint
私はそれで何かをすることができますか?
UPD1:
答えは、プログラムで EditText のヒントを設定し、xml で TextInputLayout のヒントを設定することでした。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:hint="@string/prompt_quantity"
android:layout_height="wrap_content">
<EditText
android:id="@+id/quantity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
と
quantityEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
quantityEditText.setHint(hasFocus ? "0" : "");
}
});