Reputation: 1037
I know there're a few similiar questions but I haven't found correct answer. I try to use tabs in my app. I've created styles-21 file which looks like this :
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base"/>
<!-- inherit from the material theme -->
<style name="AppTheme.Base" parent="AppTheme.Base">
<!-- colorPrimary is used for the default action bar background -->
<item name="android:colorPrimary">#3F51B5</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="android:colorPrimaryDark">#303F9F</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="android:colorAccent">#FF4081</item>
</style>
<style name="MyCustomTabLayout" parent="AppTheme.Base">
<item name="tabIndicatorColor">@color/dark_blue</item>
</style>
</resources>
However when I try to build project I'm getting an error :
Error:(20, 25) No resource found that matches the given name: attr 'tabIndicatorColor'.
Error:Execution failed for task ':Baseline:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Programowanie\sdk1\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
I try to use different sdk, changed target version in appcompat properties file but still got the same error. My gradle looks like this :
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile project(':zxing-2.3.0:android')
compile project(':google-play-services_lib')
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.1.1'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
}*/
Any idea what am I doing wrong ?
Upvotes: 0
Views: 1062
Reputation: 2126
You can achieve the same effect by changing the color of the title of the tab or have an indicator bar. Basically you need to add a selector that will change the color. Look at this for a good example: http://www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html
This is another example of a really good material design tab layout with an indicator bar: http://www.androidhive.info/2015/09/android-material-design-working-with-tabs/
Upvotes: 1