我嘗試使用TextInputLayout,我成功更改了浮動標籤的顏色,使用post,使用android:theme="@style/TextLabel"
使浮動標籤顏色發生變化。但是,它只適用於Android 5.0及更高版本。android-在TextInputLayout中更改浮動標籤的顏色
對於較低版本的Android,我使用app:hintTextAppearance="@style/TextAppearance.AppCompat"
。這裏是我的代碼:
<style name="EditTextHint" parent="TextAppearance.AppCompat">
<item name="android:textColor">#bbbbc9</item>
<item name="android:textColorHint">#bbbbc9</item>
<item name="android:textSize">11.5sp</item>
</style>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/EditTextHint">
<EditText
android:id="@+id/fet_input_left"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:paddingTop="7.5dp"
android:textColor="#595968"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
的問題是,浮動標籤的顏色只更改爲#bbbbc9
當用戶選項卡上的EditText。如果另一個EditText上的用戶選項卡,顏色將更改爲默認值。下面是圖片:
如果您有任何建議,請讓我知道。任何想法,將不勝感激。
預先感謝您!
您可以參考這裏http://stackoverflow.com/questions/30546430/how-to-change-the-floating-label-color-of-textinputlayout –
@SoManTony:感謝您的評論,您的鏈接與我閱讀的帖子完全相同。你有其他建議嗎? – LuongTruong