I am using recently released Android Design Support Library to show floating label with EditTexts. But i am facing the problem that the Hint on the EditText is not showing w
I solved my problem with this code:
new Handler().postDelayed(
new Runnable() {
@Override
public void run() {
TextInputLayout til = (TextInputLayout) someParentView.findViewById(R.id.til);
til.setHint("Your Hint Text");
til.bringToFront();
}
}, 10);
The key here is the bringToFront
. It forces the TextInputLayout
to redo its drawing, which is not the same as doing invalidate()
. If you are trying to display the TextInputLayout
on a view
that has animations
or tranistions
, you need to execute the above code at the end of the animation
or transition
. Just make sure that the code above runs on the UI thread
.