android - 如何更改文本输入布局的提示文本颜色

标签 android colors android-textinputlayout

您好,我在我的应用中使用了 TextInputLayout。我想将提示文本颜色和 float 标签颜色(聚焦和未聚焦)设置为白色。我试过下面的代码。

  <android.support.design.widget.TextInputLayout
 android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:theme="@style/TextLabel">

<android.support.v7.widget.AppCompatEditText
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:hint="Hiiiii"
android:id="@+id/edit_id">
 </android.support.v7.widget.AppCompatEditText>
</android.support.design.widget.TextInputLayout>

<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>
</style>

它适用于 Lollipop 但不适用于低版本。我怎样才能在低版本中也能达到同样的效果?

最佳答案

我得到了答案。在低于 Lollipop 的操作系统版本中,我们必须在应用程序主题中将文本颜色设置为白色(在我的例子中)。然后它将起作用。

关于android - 如何更改文本输入布局的提示文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31113620/

相关文章:

jquery - 使用 jQuery 的图像像素颜色选择器

android - 当点击相机时,Android Live Wallpaper崩溃

java - Google map : input Lat and Long and receive images, 信息、名称等

java - 如何在同一 Activity 中同步运行 Espresso 测试套件测试类?

image - 是否可以使用 opencv 在同一窗口上显示黑白和彩色图像?

c# - .NET Color 中的 RGB 格式

android - 将空错误设置为 TextInputLayout

android - 更改 AlertDialog 中“确定”按钮的颜色

android - DownloadManager 没有收到下载完成的 Action

android - 在 TextInputLayout.OutlinedBox 中自定义边界框描边