Стиль не применяется при вызове - PullRequest
0 голосов
/ 22 ноября 2018

, так что я новичок в Android, и это моя проблема: - когда я называю стиль для textview, это ничего не меняет, вот мой style.xml:

<?xml version="1.0" encoding="utf-8"?>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- App branding color for the app bar -->
    <item name="colorPrimary">#009688</item>
    <!-- Darker variant for the status bar and contextual app bars -->
    <item name="colorPrimaryDark">#00796B</item>
    <!-- Theme UI controls like checkboxes and text fields -->
    <item name="colorAccent">#536DFE</item>
</style>

<!-- Style for header text in the order form -->
<style name="HeaderTextStyle">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">48dp</item>
    <item name="android:gravity">center_vertical</item>
    <item name="android:textAllCaps">true</item>
    <item name="android:textSize">15sp</item>
    <item name="android:textColor">#FF5252</item>
</style>

и вот как я называю стиль

    <TextView
    android:hint="@string/topping"
    style="@style/HeaderTextStyle"
    />

Я пытался изменить только цвет текста, используя

android:textColor="#FF5252"

, но это не помоглоничто

кто-то может мне помочь, Я буду так благодарен, Заранее спасибо

1 Ответ

0 голосов
/ 23 ноября 2018

Вы устанавливаете textColor, пока вы еще не установили текст, вам нужно изменить textColo на textColorHint или изменить подсказку на text, если вы хотите использовать textColor, для подсказки вы используете textColorHint, а для текста вы используете textColor, как этот.

<TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="some text"
            android:textColor="@color/colorPrimaryNero"
            android:hint="some hint"
            android:textColorHint="@color/colorPrimaryWhite" />
...