3

Я использую <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

minSdkVersion 16
targetSdkVersion 22

В этом стиле надо изменить толщину Индикатора и его цвет. Как это сделать с помощью стилей?

введите сюда описание изображения

На данный момент у меня в стилях

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

        <!-- Customize your theme here. -->
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="actionBarTabBarStyle">@style/ActionBarTabStyle</item>
    </style>

    <style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
        <item name="background">@color/BackgroundColorActionBar</item>
        <item name="android:titleTextStyle">@style/MyTitleTextStyle</item>
    </style>

    <style name="MyTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/White</item>
    </style>

    <style name="ActionBarTabStyle" parent="@style/Widget.AppCompat.ActionBar.TabView">
        <item name="android:background">@color/BackgroundColorTabActionBar</item>
    </style>

</resources>

Вот либки

compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.0'

1 ответ 1

4

Можно попробовать создать такой style:

<style name="MyTabWidgetStyle" parent="Base.Widget.Design.TabLayout">
    <item name="tabIndicatorColor">@color/targetColor</item>
    <item name="tabIndicatorHeight">1dp</item>
</style>

и прикрутить его к TabLayout

<android.support.design.widget.TabLayout
    ...
    style="@style/MyTabWidgetStyle"
/>
5
  • Не помогло. Возможно я не совсем понял как прикручивать стиль
    – Camel
    10 дек 2015 в 21:30
  • @Camel ну так показывайте как пробовали...какие либы подключены
    – ermak0ff
    11 дек 2015 в 5:45
  • Добавил данные в тело вопроса.
    – Camel
    11 дек 2015 в 10:33
  • @Camel ну так вставляйте в свой стайл тот который я привел, и в разметке у TabLayout укажите этот стайл
    – ermak0ff
    11 дек 2015 в 11:08
  • Сделал, получаю такую ошибку Error:(10, 22) No resource found that matches the given name: attr 'android.support.design.widget.TabLayout'.
    – Camel
    15 дек 2015 в 12:20

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.