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
If you are setting your EditText hint programmatically it wouldn't work! You need to set the hint on the TextInputLayout it self.
TextInputLayout textInputLayout = (TextInputLayout) findViewById(R.id.usernameTextInputLayout);
textInputLayout.setHint(getString(R.string.username_hint));
Here is the XML in case you are wondering:
<android.support.design.widget.TextInputLayout
android:id="@+id/usernameTextInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/usernameEt"
android:layout_width="match_parent"
android:layout_height="@dimen/default_height"
android:layout_marginEnd="@dimen/default_margin"
android:layout_marginStart="@dimen/default_margin"
android:maxLength="@integer/username"
tools:hint="Username" />
</android.support.design.widget.TextInputLayout>
This issue is fixed in version 22.2.1
This issue is resolved in v23.0.1
of support design library. I also updated my appcompat-v7
to 23.0.1
, compileSdkVersion
to 23
& buildToolsVersion
to 23.0.1
in build.gradle.
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
Problem is the hint color. It becomes white when typing something. Please change the hint color or change the background color. You will see the hint while typing.