I have been trying to get action bar icon and for some reason it is not coming at all.
Does the size matters when displaying any icon for action bar?
Mine is: 64*64 px.
My Application Manifest looks like this:
<application
android:allowBackup="true"
android:logo="#mipmap/icon_welcome_logo"
android:icon="#mipmap/icon_welcome_logo"
android:label="#string/app_name"
android:theme="#style/CustomActionBarTheme"
>
I have even tried to set the same through coding, as well as custom style.
Please advise if I am doing anything wrong??
public class MainActivity extends ActionBarActivity {
public static final String TITLE = "Account Details";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().setTitle(TITLE);
getSupportActionBar().setIcon(R.drawable.ic_launcher);
getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
Style.xml
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionMenuTextColor">#color/actionbar_text</item>
</style>
<!-- general styles for the action bar -->
<style name="MyActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">#style/TitleTextStyle</item>
<item name="android:background">#color/actionBarBackground</item>
<item name="android:icon">#mipmap/icon_welcome_logo</item>
<item name="android:logo">#mipmap/icon_welcome_logo</item>
<item name="android:displayOptions">useLogo</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">#style/TitleTextStyle</item>
</style>
<!-- action bar title text -->
<style name="TitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/actionBarTextColor</item>
<item name="android:textSize">#dimen/actionBarTextSize</item>
</style>
</resources>
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
defaultConfig {
applicationId "au.com.app"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.1'
}
I believe your issue is similar to https://stackoverflow.com/a/26451433/950427.
Change:
getSupportActionBar().setTitle(TITLE);
getSupportActionBar().setIcon(R.drawable.ic_launcher);
getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
To:
getSupportActionBar().setTitle(TITLE);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true); // <-- added
getSupportActionBar().setIcon(R.drawable.ic_launcher);
Dependency Updates(Unrelated to question):
dependencies {
compile 'com.android.support:appcompat-v7:22.0.0' // <-- Updated
compile 'com.squareup.dagger:dagger:1.2.2' // <-- Updated
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.1' // <-- brings in core
}
Related
Every attribute prefaced by "android:" in my styles.xml below is giving me a "cannot resolve symbol" error. It's been like this for a while so I'm not sure where it began and what causes it. Removing "android:" gives me a "resource linking failed" error in the build log.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="TheoTheme" parent="AppTheme">
<item name="colorAccent">#color/Accent</item>
<item name="android:colorBackground">#color/lightBackground</item>
</style>
<style name="TheoTheme.ActionBarReverse" parent="TheoTheme">
<item name="android:textColorPrimary">#color/text_color_primary</item>
</style>
<style name="PurpleTheme" parent="TheoTheme">
<item name="colorAccent">#color/Accent2</item>
</style>
<style name="ChatRoomTheme" parent="TheoTheme">
<item name="colorAccent">#color/Accent</item>
</style>
<style name="LoginTheme" parent="TheoTheme" >
<item name="android:colorBackground">#color/colorPrimary</item>
</style>
<style name="RegisterTheme" parent="TheoTheme">
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="FirebaseUI.AuthMethodPicker.Logo">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="gravity">center</item>
</style>
<style name="GenericProgressBackground" parent="android:Theme">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:background">#color/colorPrimaryDark</item>
<item name="android:gravity">center</item>
</style>
<style name="GenericProgressIndicator" parent="#android:style/Widget.ProgressBar">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:indeterminate">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="DMTheme.AppTheme" parent="ChatRoomTheme" />
build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
signingConfigs {
ReleaseKey {
file('X:\\Documents\\All\\Creative\\Programming\\Projects\\KeyStore\\TheoKeyStore.jks')
}
}
compileSdkVersion 28
defaultConfig {
applicationId "app.meettheo.theo"
minSdkVersion 19
targetSdkVersion 28
versionCode 5
versionName "0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.ReleaseKey
}
debug {
signingConfig signingConfigs.ReleaseKey
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v13:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'android.arch.paging:runtime:1.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.jetbrains:annotations:16.0.2'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-ads:17.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.6#aar') {
transitive = true
}
}
apply plugin: 'com.google.gms.google-services'
Invalidating/cleaning/rebuilding does not work. What did I break to make this happen?
I think you could try the following solution:
Back up project
Delete the .idea folder and .iml files
Relaunch Android Studio and re-import the project.
For some people it will work to just remove all the libraries from .idea folder and re-sync Gradle.
If none of these are working you always could reinstall the complete studio which, depending on your network speed, wouldn't take that long.
go to your gradle, comment out the support libraries you're using, sync your project and you will get errors. Then uncomment the libraries and sync again. Now the project will be successfully built, and chances are your problem will be resolved. I'm not sure how this is caused in the first place, but the above solution has worked for me in the past when caches/clean/rebuilt would fail.
Edit: Also depending on the property you might want to add app: instead of android:
I've had that issue for some time and that also pissed me off.
Guess what's the solution? As simple as re-importing the project again via File -> Open:
Thereafter all of the resources were correctly resolved.
I want to change colors in my application, by overriding theme. I have several themes which user can choose. I got this error in Android Studio when trying to override theme:
No resource found that matches the given name at android:colorForegroundInverse with value #color/foreground_material_light
values\styles.xml
<resources>
<style name="LigthTheme" parent="#style/Theme.AppCompat">
<!-- <item name="colorPrimary">#color/aztec_gold</item>
<item name="colorPrimaryDark">#color/licorice</item>
<item name="colorAccent">#color/accent_material_light</item>
<item name="android:itemBackground">#color/aztec_gold</item>
<item name="android:background">#color/aztec_gold</item>
-->
</style>
<style name="RetroTheme" parent="#style/Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimaryDark">#color/nickel</item>
<item name="colorPrimary">#color/spanish_gray</item>
<item name="colorAccent">#color/turtle_green</item>
<item name="android:windowBackground">#color/white_smoke</item>
<item name="android:colorBackground">#color/white_smoke</item>
<item name="android:textColorPrimary">#color/black</item>
<item name="android:textColorSecondary">#color/black_light</item>
<item name="android:textColorSecondaryInverse">#color/white</item>
<item name="android:textColorPrimaryInverse">#color/white_smoke</item>
<item name="android:colorForeground">#color/white_smoke</item>
<item name="colorButtonNormal">#color/june_bud</item>
<item name="android:colorForegroundInverse">#color/white_smoke</item>
</style>
<style name="DarkTheme" parent="#style/Theme.AppCompat">
<!-- <item name="colorPrimary">#color/aztec_gold</item>
<item name="colorPrimaryDark">#color/licorice</item>
<item name="colorAccent">#color/accent_material_light</item>
<item name="android:itemBackground">#color/aztec_gold</item>
<item name="android:background">#color/aztec_gold</item>
-->
</style>
values\colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="spanish_gray">#9e9e9e</color>
<color name="pastel_gray">#cfcfcf</color>
<color name="nickel">#707070</color>
<color name="june_bud">#aed851</color>
<color name="pale_goldenrod">#e1ffb1</color>
<color name="turtle_green">#7da453</color>
<color name="white_smoke">#f5f5f5</color>
<color name="black">#d2000000</color>
<color name="black_light">#9c000000</color>
<color name="black_light1">#9c000000</color>
<color name="white">#ffffff</color>
</resources>
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ivan.vts.mapper"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize "2048M"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.google.code.gson', name: 'gson', version: '2.4'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-location:10.2.4'
compile 'com.google.android.gms:play-services-maps:10.2.4'
compile 'com.google.android.gms:play-services-places:10.2.4'
compile 'com.android.support:multidex:1.0.1'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
testCompile 'junit:junit:4.12'
}
Tried to put colorForegroundInverse and foreground_material_light in styles.xml, colors.xml, set parent to different themes bt always the same error.
Thanks in advance.
EDIT:
I can add in colors.xml something like:
<color name="foreground_material_light">#fff</color>
and there's warning, but no errors. It doesn't feel right to me.
You can try accessing the color as
#android:color/foreground_material_light
I am using android studio 2.2.3. All of my layout xmls are complaining about "Missing styles". Following is the error that I am getting when I open the design view.
Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'progressBarStyle' in current theme (1568 similar errors not shown) Failed to find '?attr/textAppearanceSmall' in current theme. (65 similar errors not shown)
I have also noticed that styles.xml is unable to find "Theme.AppCompat.Light.NoActionBar". I have checked the project structure and I am able to see the com.android.support.appcompat-v7:25.2.0 in the list of dependencies. I performed invalidate caches and restart, clean/build. But I am unable to get rid of the missing styles issue. I have also tried renaming my "AppTheme" to "AppBaseTheme" and referencing this in my android manifest file. Even that did not help. I have tried doing a refresh in the design view but still cannot get rid of the missing styles error.
For another xml layout, I am getting the following error
Rendering Problems Missing styles. Is the correct theme chosen for this layout? >Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. The following classes could not be instantiated:
- android.support.design.widget.TabLayout (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library. at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36) at android.support.design.widget.TabLayout.(TabLayout.java:297) at android.support.design.widget.TabLayout.(TabLayout.java:291) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.inflate(LayoutInflater.java:518) at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
Can some one please point me in the right direction? Thanks.
Following is my manifest.
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:name=".ExampleApplication"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".activity.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
</application>
Following is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.package"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "4g"
}
lintOptions {
abortOnError false
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.6'
compile group: 'com.google.guava', name: 'guava', version: '20.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.github.zagum:Android-SwitchIcon:1.3.2'
compile 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
compile 'com.prolificinteractive:material-calendarview:1.4.2'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.google.dagger:dagger:2.7'
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:3.0"
testCompile "org.robolectric:shadows-support-v4:3.0"
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
compile 'com.android.support.constraint:constraint-layout:1.0.0'
}
Following is my styles.xml.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:textViewStyle">#style/RobotoTextViewStyle</item>
<item name="android:editTextStyle">#style/RobotoEditTextStyle</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">#drawable/splash</item>
</style>
<style name="RobotoTextViewStyle" parent="android:Widget.TextView">
<item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">#dimen/body</item>
<item name="android:textColor">#color/colorBlack</item>
</style>
<style name="RobotoEditTextStyle" parent="android:Widget.EditText">
<item name="android:fontFamily">sans-serif</item>
<item name="android:textSize">#dimen/body</item>
<item name="android:padding">#dimen/edittext_padding</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#android:color/white</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="TextInputLayoutStyle" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">#color/color_android_green</item>
<item name="android:textStyle">bold|italic</item>
</style>
<style name="TextInputLayoutStyleError" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">#color/colorRed</item>
<item name="android:textStyle">bold|italic</item>
</style>
<style name="CustomTextStyle" parent="#android:style/TextAppearance.Widget.TabWidget">
<item name="android:textSize">20sp</item>
</style>
<style name="CustomSwitch" parent="Theme.AppCompat.Light">
<!-- active thumb & track color (30% transparency) -->
<item name="colorControlActivated">#color/colorAccent</item>
<!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">#color/colorGrayDarker</item>
<!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#color/colorGray</item>
</style>
<style name="CustomTabLayout" parent="Base.Widget.Design.TabLayout">
<item name="tabIndicatorColor">#color/colorGold</item>
<item name="tabSelectedTextColor">#color/colorGold</item>
</style>
<style name="StyledScrollerTextAppearance">
<item name="android:textColor">#color/colorWhite</item>
</style>
Tablayout xml snippet
<android.support.design.widget.TabLayout
android:id="#+id/callScheduleType"
style="#style/CustomTabLayout"
android:layout_width="0dp"
android:layout_height="40dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/guidelineNavHeight">
<android.support.design.widget.TabItem
android:id="#+id/personal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="personal"/>
<android.support.design.widget.TabItem
android:id="#+id/community"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="community"/>
</android.support.design.widget.TabLayout>
I was able to solve this issue by reverting back the android gradle plugin version from classpath 'com.android.tools.build:gradle:2.3.0-beta4' to classpath 'com.android.tools.build:gradle:2.2.3' in the projects top level build file.
When i go to clean project I am left with 3 errors and I am not sure what to do, code below. Please could someone help?
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From:
file:/usr/local/google/buildbot/repo_clients/https___googleplex-
android.googlesource.com_a_platform_manifest.git/mnc-
release/frameworks/support/v7/appcompat/res/values-
v23/styles_base_text.xml -->
<eat-comment/>
<style name="Base.TextAppearance.AppCompat.Widget.Button.Inverse" parent="android:TextAppearance.Material.Widget.Button.Inverse"/>
<!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/values-v23/themes_base.xml -->
<eat-comment/>
<style name="Base.Theme.AppCompat" parent="Base.V23.Theme.AppCompat"/>
<style name="Base.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light"/>
<style name="Base.V23.Theme.AppCompat" parent="Base.V22.Theme.AppCompat">
<!-- We can use the platform drawable on v23+ -->
<item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>
<item name="controlBackground">#drawable/abc_control_background_material</item>
</style>
<style name="Base.V23.Theme.AppCompat.Light" parent="Base.V22.Theme.AppCompat.Light">
<!-- We can use the platform drawable on v23+ -->
<item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>
<item name="controlBackground">#drawable/abc_control_background_material</item>
</style>
<!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-release/frameworks/support/v7/appcompat/res/values-v23/styles_base.xml -->
<eat-comment/>
<style name="Base.Widget.AppCompat.Button.Colored" parent="android:Widget.Material.Button.Colored"/>
Check out your build.gradle file and make the changes as below,
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.inzi.app"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
Check for the compileSdkVersion (should be 23), buildTiilVersion (should be 23) and also the dependencies ('com.android.support:appcompat-v7:23.0.0')...
Let me know if it works...
And mark it as an answer so that it would be useful to others...
Im trying to customize my ActionBar, I´m following this tutorial by Android Developers --> Link, but it doesn´t channge, I specified the theme in the Android Manifest:
android:theme="#android:style/Theme.Holo" and, in my styles.xml:
And also I changed my styles.xml:
<style name="AppTheme" parent="Theme.AppCompat">
</style>
Also, I have the last version of the library:
And it is referenced in my App Grandle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.cheescake.juno"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
`proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}
I followed all the steps and I dont know why my ActionBar is in theme light yet. Maybe can be a stupid error and I didn´t understand something, but I have 2 days with this problem =(
Thanks !
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#android:color/white</item>
</style>
And in Manifest file
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
After specifying the colour of your theme e.g:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
....
</style>
Add the following line to the AndroidManifest.xml file
<application
...
android:theme="#style/AppTheme" >
....