yılında app:hintAnimationEnabled="false"
eklemek İşte
Ben bugüne kadar ne olduğunu Bunu elde etmenin üç yolu olabilir:
numaralı telefonunumaralı _
karakterine ayarlayın ve EditText
numaralı telefondan android:hint="This is my cool hint"
öğesini koruyun.
<android.support.design.widget.TextInputLayout
....
....
android:hint=" "> <<----------
<EditText
....
....
android:hint="This is my cool hint"/> <<----------
</android.support.design.widget.TextInputLayout>
TextInputLayout
EditText's
ipucu kullanmadan önce aşağıdaki kontrolü gerçekleştirir, çünkü bu işleri: android:hint=" "
ayarlayarak
// If we do not have a valid hint, try and retrieve it from the EditText
if (TextUtils.isEmpty(mHint)) {
setHint(mEditText.getHint());
// Clear the EditText's hint as we will display it ourselves
mEditText.setHint(null);
}
, if (TextUtils.isEmpty(mHint))
false
için değerlendirir ve EditText
onun ipucu korur.
<your.package.name.CTextInputLayout
....
.... > <<----------
<EditText
....
....
android:hint="This is my cool hint"/> <<----------
</your.package.name.CTextInputLayout>
:
public class CTextInputLayout extends TextInputLayout {
public CTextInputLayout(Context context) {
this(context, null);
}
public CTextInputLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
if (child instanceof EditText) {
// cache the actual hint
CharSequence hint = ((EditText)child).getHint();
// remove the hint for now - we don't want TextInputLayout to see it
((EditText)child).setHint(null);
// let `TextInputLayout` do its thing
super.addView(child, index, params);
// finally, set the hint back
((EditText)child).setHint(hint);
} else {
// Carry on adding the View...
super.addView(child, index, params);
}
}
}
Sonra tasarım desteği kütüphanesinden birinin yerine özel CTextInoutLayout
kullanın:
İkinci seçenek TextInputLayout
alt sınıf ve addView(View child, int index, ViewGroup.LayoutParams params)
yöntemini geçersiz olacaktır 3 Üçüncüsü, ve muhtemelen en basit yol, aşağıdaki çağrıları yapmak olabilir:
// remove hint from `TextInputLayout`
((TextInputLayout)findViewById(R.id.textContainer)).setHint(null);
// set the hint back on the `EditText`
// The passed `String` could also be a string resource
((EditText)findViewById(R.id.myEditText)).setHint("This is my cool hinttt.");
İyi bir fikir programlama Eğer ipucu ve textChange olay zamanı editbox fikri size yardımcı olabilecek –
Sorun ipucu renktir null ipucu ver vermek zorunda. Bir şey yazarken beyaz olur. Lütfen ipucu rengini değiştirin veya arka plan rengini değiştirin. Yazarken ipucunu göreceksiniz. –