FAQ Database Discussion Community


android appcompat v22 2 Global theme overrides toolbar theme for burger icon

android,toolbar,android-theme,appcompat-v7-r22.2
I'm using the support library AppCompat v7 22.2. My app uses a light theme that I've set up as follows <style name="Theme.SM3Theme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/s3m_primary</item> <item name="colorPrimaryDark">@color/s3m_primary_dark</item> <item name="colorAccent">@color/s3m_accent</item> </style> In my manifest I have <application android:allowBackup="false" android:icon="@drawable/icon" android:theme="@style/Theme.SM3Theme" I want my...

How to Change the Text Selection Toolbar color which comes when we copy a text?

android,android-textview,android-5.0-lollipop,android-theme
I am developing an application and i set "android:textIsSelectable" for the TextViews. But my material theme is not matching with the TextSelection appBar. Is there a way by which i can change the color of that appBar ?? Attached the Image Below Check it :- ...

Unable to customize AppTheme for action bar in Android app

android,android-theme
I'm trying to customize the action bar. I've done it before too, but I'm unable to do it now. Not sure where I'm going wrong. <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="android:actionBarStyle">@style/MyActionBar</item> </style> <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> <item...

Android - Back button doesn't call onResume()

android,back-button,android-theme,onresume,up-button
I'm a beginner at this, so bear with me. In my app, I want the theme of the app to update based upon user preference. I have a preferences page with a theme section, and here is the code for my MainActivity: @Override protected void onCreate(Bundle savedInstanceState) { SharedPreferences preferences...

Action bar color does not change when using Theme.AppCompat

android,appcompat,android-theme
All I am trying to do is have the actionbar and status bar change colors to have material design. Below is the theme I have created: <!-- Base application theme. --> <style name="AppTheme2" parent="Theme.AppCompat"> <!-- colorPrimary is used for the default action bar background --> <item name="android:colorPrimary">#FF5722</item> <!--<item name="android:statusBarColor">#E64A19</item>--> <!--...

Issue Android Studio 1.0.2: Fatal Exception: main Process java.lang.NullPointerException

java,android,nullpointerexception,android-theme
So, I am doing this project that includes an intro activity that switches to a menu activity with navigation drawer. Couple of days ago, I had an issue switching from intro to menu (Android Studio 1.0.2: java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.NullPointerException) and it was solved by changing name="AppTheme"...

App crashes on changing theme under styles

android,android-studio,android-theme,android-styles,android-compatibility
My Android App : Target API:22 Min API:15 Device run on :API level 22 I don't understand this whole theme concept , In my manifest.xml ,I have set android:theme="@style/AppTheme" and all activities use this theme Now my understanding is that they all use the theme called AppTheme which I can...

Android - Overriding a Style per Theme

android,styles,android-theme,android-styles
Is there a way to change a style based on what theme is is set on an activity? for example, suppose my activity has a textview with a style set to TextViewStyle <TextView style="@style/TextViewStyle" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Text"/> This is my TextViewStyle <style name="TextViewStyle" parent="android:style/Widget.TextView"> <item name="android:textStyle">bold</item> <item name="android:textSize">8sp</item> <item...

Custom AlertDialog style Theme.AppCompat.Light.Dialog.Alert

android,android-alertdialog,android-theme,android-styles
How to make custom style for example for green buttons and background of message using AlertDialog. ??? Definition of AlertDialog: AlertDialog.Builder alert = new AlertDialog.Builder(About.this, R.style.MY_AlertDialog); And style: <style name="MY.AlertDialog" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="android:windowBackground">@color/green</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowIsFloating">true</item> <item...

How will Android select the correct resource given the pixel density and API version of the running device?

android,android-layout,android-activity,android-theme,android-styles
I am studying Android examples and I am quite confused by the structure inside the res folder. res ├───drawable-hdpi │ ic_action_search.png │ ic_launcher.png │ ├───drawable-ldpi │ ic_launcher.png │ ├───drawable-mdpi │ ic_action_search.png │ ic_launcher.png │ ├───drawable-xhdpi │ ic_action_search.png │ ic_launcher.png │ ├───layout │ activity_main.xml │ activity_result.xml │ ├───menu │ activity_main.xml │...

Unable to use 'android:windowTranslucentNavigation'

android,android-theme
There is a post of the same question and it has received an answer. I suspect my case is different and it may indicate a general problem of the project configuration. windowTranslucentNavigation is for API 19. I have set targetSdkVersion inn both build.gradle and manifests. In build.gradle: defaultConfig { applicationId...

Android Lollipop issues with text color

android,android-5.0-lollipop,android-theme,textcolor
I have an app with android:Theme.Holo, navigation bar with black background and white textcolor for Button/TextView. It's fine on OS before Lollipop. In Lollipop I can't see text, I suppose it's black too because, as I said, on previous OS it works fine. Any well-known issues about text color in...

Change theme of button on click

java,android,android-button,android-theme
I set a theme for my button. This is the code: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:shape="rectangle"> <solid android:color="@color/theme_blue_color"/> <corners android:radius="100dp"> </corners> <stroke android:width="1dp" android:color="#05f"> </stroke> </shape> Then I want that image change on click. So I create another file (I named it reverse...

Android actionbar background same color as text

android,xamarin,android-actionbar,android-5.0-lollipop,android-theme
This is my first project working with Android (Xamarin) and i was trying to style the ActionBar. I succesfully changed the background color, but now the text within it is either gone or the same color as the background. I think the second because i only changed the background. Below...

How to use Android's AppCompat theming application-wide?

android,android-theme,appcompat,android-styles,android-compatibility
IDE: Android Studio 1.1.0 ENV: Debugging on usb-connected phone using Android API v10. I'm trying to use AppCompat to support Android API v8 and up. Compiles fine but crashes when the activity is drawn, saying: lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. ...however, in...

Stylizing material buttons in Android v21

android,android-5.0-lollipop,android-button,material-design,android-theme
I am trying to maintain the material design ripple effect for devices with lollipop and above (21+) and stylize the button so that it doesn't have a large margin/space around it. Example 1: Buttons with ripple effect but with margin/gap: Example 2: Buttons with NO ripple effect and without the...

Android theme not used in library project

java,android,android-theme
I am building a library project which returns Views based on a user request. However the Views I create in the library project do not use the theme I use in my application. For example if the library project returns a Fragment which has an EditText in it, then the...

Changing Button Text color in theme for >= Android 4.2

android,android-layout,android-theme
I've been searching but still am unable to find a way. How does one change all text button colors (without modifying the android:textColor of other widgets in a scheme? NB: Does not work <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorButtonNormal">#1bbc9b</item> <!--<item...

Change title color in toolbar?

android,android-theme,android-toolbar
I have a toolbar that I use, and set title with: ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle("Home"); Is there a way to change the color from black to white? I tried making its own theme and setting it in the xml like this, but no dice: <resources> <!-- Base application theme. --> <style name="AppTheme2" parent="Theme.AppCompat">...

Apply custom theme in Android Activity

android,android-actionbar,android-theme,android-actionbar-compat
I want to apply custom theme in android action bar title, but when I'm trying to do I got an error. My Manifest: <activity android:name="com.lifegoal.eshop.Recharge_Activity" android:theme="@style/MyTheme" android:label="Mobile Recharge" > my values v11 text <!-- Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+...

Android app theme textViewStyle doesn't work on phone

android,xml,textview,styles,android-theme
I have so specific problem. I'm applying theme for all textviews. It appears on preview but when I run this app on phone I face with unstyled textview. The styles I set for other views are working. only textviewstyle is not working. In this sample textview color is green in...

appcompat v22.1 widget tinting doesn't show pre 5.0

android,appcompat,android-theme
I'm using the AppCompat lib v22.1 to give some material design to multiple android versions. If I use the new widget tinting feature, it does not show up in Kitkat even with AppCompat. in layout: <Button android:id="@+id/mybtn" android:text="Test" android:theme="@style/MyTheme.BlueButton" android:layout_width="wrap_content" android:layout_height="wrap_content" /> in theme xml: <style name="MyTheme.BlueButton"> <item name="colorButtonNormal">@color/blue</item> </style>...

Difference between style.xml and theme.xml android studio?

android,xml,android-studio,android-theme,android-styles
Hey I'm trying to change the background of my action bar but I'm not quiet sure I understand the structure of the style files. So basically I have style.xml which is to pass on some elements a desired style. Then I've Theme.xml which is to have a group of styles...

What causes android exception “You need to use a Theme.AppCompat theme (or descendant) with this activity.”

android,android-theme
I am attempting to try out the new Material Theme in Android. I am currently stuck with this exception 03-06 09:35:50.177: D/AndroidRuntime(30607): Shutting down VM 03-06 09:35:50.178: E/AndroidRuntime(30607): FATAL EXCEPTION: main 03-06 09:35:50.178: E/AndroidRuntime(30607): Process: com.example.vivz, PID: 30607 03-06 09:35:50.178: E/AndroidRuntime(30607): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.vivz/com.example.vivz.MainActivity}: java.lang.IllegalStateException: You need...

Change style for AlertDialog lower grey panel

android,alertdialog,android-theme
What style is causing the grey bar in the bottom of an AlertDialog? Either I need to change the rest of the dialog to match the color or vice versa. I've tried modifying @android:buttonStyle and @android:buttonBarStyle. That helps but there's still some grey peeking out from the edges of the...

Applying AppCompat theme to individual preferences in a PreferenceFragment

java,android,android-theme
I have been wrestling with trying to get my PreferenceFragment to have the same Material-based theme and styling (via AppCompat) as the rest of my application. The PreferenceFragment that I am using to manage all of my application settings is shown below: As you can see from the screenshot above,...

How to set color of selection in EditText in my custom theme? (android)

android,android-edittext,customization,android-theme
I created my custom theme and in my layouts I have a couple of EditText views. Since I set android:selectAllOnFocus="true" ,I've noticed that the color of selection is default one for my phone, so I was wondering can I set some attribute and which, of course, in my definition of...

Issue with AppCompat and Themes in Android

android,android-layout,android-5.0-lollipop,android-theme
I recently created a new project with minSdkVersion 15, compiled and targetedSdkVersion 21, along with a couple of activities. I would like to use the default holo dark theme for my app and according to the documentation I just need to use Theme.AppCompat. When I test this on my personal...

How to delete overlay in an Android modified Holo button?

android,button,styles,overlay,android-theme
I have this style for Buttons in my Android app, but I don't want that little shadow. <style name="AppTheme.Button.Primary" parent="@android:style/Widget.Holo.Button"> <item name="android:background">@color/primary_dark</item> <item name="android:textColor">@color/primary_light</item> <item name="android:gravity">center</item> <item name="android:textSize">15sp</item> <item name="android:layout_width">20dp</item> <item...

Why is Cast MediaRouteButton always white even on Holo.Light Action-Bar?

android,android-actionbar,android-theme,chromecast,android-styles
I'm moving from a custom MediaRouteButton to one inside the action-bar but it doesn't display properly. The button when custom was white which is what I wanted. However, the button is still white (and barely visible) on the action-bar even though the action-bar is of "Holo.Light" style. The button should...

Changing Background and text color of AppCompat Light DarkActionBar Theme on android

android,customization,android-theme,appcompat
I have used AppCompat Light DarkActionBar Theme for my App. <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> </style> Is it possible to change the background color and text color of this ActionBar ? If yes, how ?...

How to use Holo style for some views if application theme is Material?

android,android-theme
I have an Android application where app theme defined in styles.xml like this: <style name="AppTheme" parent="android:Theme.Material"> </style> (I know that it requires API level 21) But I want to use some old styles from Theme or Theme.Holo for some views. I test it on Nexus 4 with Android 5.1 API...

Setting heading colors in AppCompat Theme

android,android-theme
I am trying to figure out how to set the color for the headings in my PreferenceFragment which uses the new AppCompat theme. An screenshot of my settings Fragment, which extends PreferenceFragment, is shown below: I can set the color of the ActionBar by using the colorPrimary attribute, and the...

Android theme not applied on API v19 after migration to android studio (but is applied on API v21)

java,android,android-studio,android-theme,android-styles
I recently migrated from Eclipse to Android Studio. Now my customized theme is not appied anymore to devices below API21. Not completely sure but I think I changed nothing in my styles while migrating. What I have is: (don't wonder about the duplicates, I have two user-selectable themes) themes.xml: <?xml...

Cannot change color of actionbar with appcompact v7 and Android Studio 1.1 Preview

android,android-actionbar,android-theme
I tried many styles to change color of actionbar but not worked. This is my style: <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item> </style> <style name="AppTheme.ActionBarStyle" parent="Widget.AppCompat.ActionBar.Solid"> <item name="android:background">#f01234</item> </style> My emulator version: Android 4.2...