0
編集テキストのためのアンドロイドの素材デザインのフローティングラベルに背景色を追加したいと思います。どうやってやるの?androidの素材デザインのフローティングラベルへの背景色
編集テキストのためのアンドロイドの素材デザインのフローティングラベルに背景色を追加したいと思います。どうやってやるの?androidの素材デザインのフローティングラベルへの背景色
この
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:theme="@style/TextLabel">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Hiiiii"
android:id="@+id/editText"/>
</android.support.design.widget.TextInputLayout>
あなたstyle.xmlで
<style name="TextLabel" parent="TextAppearance.AppCompat">
<!-- Hint color and label color in FALSE state -->
<item name="android:textColorHint">@color/Color Name</item>
<item name="android:textSize">20sp</item>
<!-- Label color in TRUE state and bar color FALSE and TRUE State -->
<item name="colorAccent">@color/Color Name</item>
<item name="colorControlNormal">@color/Color Name</item>
<item name="colorControlActivated">@color/Color Name</item>
または
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:hintTextAppearance="@style/TextAppearance.AppCompat">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"/>
</android.support.design.widget.TextInputLayout>
編集のように試してみてください。それだけでlable背景を変更することはできませんあなたのeditextは背景を設定しようとするとTextInputLayoutの中にラップされ、出力は同様になります。
これにより、背景ではなく浮動ヒント/ラベルの色が変更されます。 –
ヒントの背景のみを変更しますか? – SaravInfern
はい。背景色だけを変更したい。 –