【问题标题】:Change TextInputLayout only hint text style更改 TextInputLayout 仅提示文本样式
【发布时间】:2017-03-06 05:57:29
【问题描述】:

我正在尝试将 TextInputLayout 提示文本样式更改为粗体。我使用 TextAppearance 更改了样式中的颜色和其他样式提示:

 <style name="MyTextInputLayoutTheme" parent="@android:style/TextAppearance">
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:textColorHint">@color/black_50</item>
        <item name="colorControlNormal">@color/green</item>
        <item name="hintAnimationEnabled">false</item>        
    </style>

我试着设置

<item name="android:textStyle">normal</item>

<item name="android:textStyle">bold</item>

但它不起作用。提示文本总是有编辑文本的样式(如果edittext是粗体,它会自动有粗体提示,如果不是,提示是正常的):

【问题讨论】:

    标签: android styles hint textstyle


    【解决方案1】:

    最容易想到的是:

    在strings.xml中&lt;string name="myHint"&gt;&lt;b&gt;Your hint here&lt;/b&gt;&lt;/string&gt;
    在你的 layout.xml 文件中&lt;EditText android:hint="@string/myHint"/&gt;

    【讨论】:

      猜你喜欢
      • 2015-09-15
      • 2020-05-21
      • 1970-01-01
      • 1970-01-01
      • 2018-11-20
      • 1970-01-01
      • 2020-06-26
      • 2018-11-03
      • 2018-12-29
      相关资源
      最近更新 更多