All holo effects disappeared on redownloading sdk? - java

I was making an android app in eclipse, using some Holo elements in the UI. It worked fine. Then I deleted the eclipse and sdk folder, and redownloaded it. Didn't touch the app at all in the interim. Now all the holo effects are gone, as you can see in the pictures below. How can I fix this? Thanks.
Before:
After:
Here is my styles.xml:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Black">
<item name="android:editTextStyle">#style/edittext_holo</item>
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<style name="edittext_holo" parent="#android:style/Widget.EditText">
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
<item name="android:clickable">true</item>
<item name="android:background">#drawable/edit_text_holo_dark</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:gravity">center_vertical</item>
<item name="android:textColorHint">#FFFFFF</item>
<item name="android:textColorHighlight">#FF0000</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
</style>
</resources>

The problem is that your AppBaseTheme style inherits from android:Theme.Black.
This is the pre-Holo default theme.
Your theme should inherit from a Holo theme (such as android:Theme.Holo). Based on your screenshot, you want Theme.Holo.Light.DarkActionBar, so your styles.xml should look like this:
<style name="AppBaseTheme" parent="android:Theme.Holo">
If you are supporting any SDK version below 14, this should go in the values-14/styles.xml file, as Holo does not exist on pre-14 devices.
For more information, see the Styling the Action Bar and the Styles and Themes documentation.

Related

How to stop Facebook SDK Dialog using white textcolor even if my theme needs white text

As much as I learn, I still have a long way to go ...
I'm trying to use Facebook SDK to provide details for a sign up.
I am using a blue, yellow and white theme for my app; the text being white. My style setup is:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#android:color/holo_orange_light</item>
<item name="android:colorBackground">#color/colorMainBackground</item>
<!--<item name="android:actionBarStyle">#style/ThemeActionBar</item>-->
<!--<item name="android:windowActionBarOverlay">true</item>-->
<item name="android:textColor">#android:color/white</item>
<item name="android:textColorLink">#android:color/holo_orange_light</item>
<!-- Support library compatibility -->
<!--<item name="actionBarStyle">#style/ThemeActionBar</item>-->
<!--<item name="windowActionBarOverlay">true</item>-->
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:titleTextColor">#color/yellow</item>
<item name="android:textColorPrimaryInverse">#android:color/black</item>
<item name="android:navigationBarColor">?android:attr/statusBarColor</item>
<item name="android:textColorSecondary">#android:color/white</item>
</style>
However, when Facebook shows a dialog box, all I get is a white square:
It would appear that Facebook are using my textcolor and hence the white box. Is there a way I can override this? Or have Facebook use the default colour scheme (if there is one).
This is somewhat frustrating me now.
My Manifest entry for Facebook is:
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
Thanks in advance
Facing the same issue. It seems FacebookActivity picks up the color from the style you declared in the application tag.
<application
...
android:theme="#style/AppTheme'>
You see it white because in styles.xml you have the accent color to white. for your theme.
<item name="colorAccent">#FFF</item>
Since in my application I need the colorAccent to be another color, I chose to have two AppThemes. One for my activities with whatever colorAccent I need and one for the application that will get used by Facebook.
I tried to add a theme to com.facebook.FacebookActivity but it gets ignored. Something to do with ManifestMerging.

Changing the color of an Action Bar

<style name="Theme_Base_App" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
I simply copied the above code to my styles.xml file and I copied
android:theme="#style/Theme_Base_App"
into my manifest file. How do I now change the color of this action bar?
Also, can someone explain me what exactly I am doing by using these lines of code? What is the manifest file for? And what am I doing in the Styles.xml file?
To change your color just set the colorPrimary in your colors.xml file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">your color</color>
</resources>
Using this style you are defining your custom theme inheriting from AppCompat theme.
<!-- inherit from the material theme -->
<style name="Theme_Base_App" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="colorPrimary">#color/colorPrimary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
</style>
You can refer this link for more info.
The Android Manifest file presents essential information about your app to the Android system. With
android:theme
you are defining a reference to a style resource defining a default theme for all activities in the application. Individual activities can override the default by setting their own theme attributes. For more information, see the Styles and Themes developer guide.
Here you can find more info about Manifest and application element in the Manifest.

Custom Background Color for ActionBar settings area

I would like to change the color of my settings Tab located on the ActionBar, I have done very extensive research here and in other sources.
My Android version is 4.4.2.
My manifest is declared this way:
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="19" />
Basically I am doing what other sources showed me to:
<style name="AppBaseTheme" parent="android:style/Theme.Holo.Light">
</style>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:panelFullBackground">#drawable/menu_background</item>
</style>
I also have replaced the android:panelFullBackground property for android:panelBackground, android:panelColorBackground and android:panelColorForeground switching from drawable resources to color values for each without results.
Finally I have also tried using ListPopupWindow parent variant:
<style name="AppBaseTheme" parent="android:style/Theme.Holo.Light">
</style>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:popupMenuStyle">#style/PopupMenu</item>
</style>
<style name="PopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:panelFullBackground">#drawable/menu_background</item>
</style>
Here I have also switched the android:panelFullBackground property for android:panelColorBackground and android:popupBackground properties mixing them up with #android:color and #drawable resources too but is not working either.
Can you please tell me an effective way to configure this through the styles.xml file?
Thank you very much
Maybe you need to use Android Asset studio's ActionBarStyleGenerator to easily handle colors and not going through all the stuff. If you need more customizing on each Tab then you need to get a reference to actionbar using getActionBar()(or getSupportActionBar() in case of support actionbar) and create custom views Programmatically and add them to your actionbar using addTab(...)
I managed to find the right setting for my styles to accomplish the action bar settings custom color. This post helped as well: How to change the background color of Action Bar's Option Menu in Android 4.2?
The styles go this way:
File styles.xml:
<resources>
<style name="AppBaseTheme" parent="android:style/Theme.Holo.Light">
</style>
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBarTheme</item>
<item name="android:popupMenuStyle">#style/PopupMenu</item>
<item name="android:itemTextAppearance">#style/TextAppearance</item>
</style>
<style name="MyActionBarTheme" parent="#android:Widget.Holo.Light.ActionBar">
<item name="android:background">#3892D3</item>
<item name="android:titleTextStyle">#style/MyActionBarTheme.Text</item>
</style>
<!--
This style reference did it, you can put a drawable resource or color resource reference there as well. For example: #drawable/menu_dropdown_image or #android:color/white
-->
<style name="PopupMenu" parent="#android:Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#3892D3</item>
</style>
<!---->
<style name="MyActionBarTheme.Text" parent="#android:TextAppearance">
<item name="android:textColor">#android:color/white</item>
<item name="android:textSize">20sp</item>
</style>
<style name="TextAppearance">
<item name="android:textColor">#android:color/white</item>
</style>
</resources>
Thank you!

How to change the title text color and the color of the background on the ActionBar?

Here's my styles.xml file:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyCustomTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBarTheme</item>
<item name="android:actionMenuTextColor">#style/TitleBarTextColor</item>
</style>
<style name="MyActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#060EBB</item>
</style>
<style name="MyActionBarTitleText"
parent="#style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#00B300</item>
</style>
<style name="TitleBarTextColor" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#00B300</item>
</style>
</resources>
Here's my manifest file:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyCustomTheme" >
The background of the ActionBar is changing color the way I want it to, but the text itself isn't. What am I doing wrong? Oh, and some explanation of the way styles.xml works within Android would be nice too. It seems to be very confusing.
change your
code from
<style name="MyActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#060EBB</item>
</style>
to
<style name="MyActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#060EBB</item>
<item name="android:titleTextStyle">#style/TitleColor</item>
</style>
<style name="TitleColor" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#00B300</item>
</style>
Style.xml
style.xml file states what are the styles you want to use in your app, basically it inherits android default style
as you can see in every style tag which ever property you want to set you give it a name
<style name="TitleColor" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
and say what property of parent style you want to override, Parent style is the theme which you selected as default theme when you created app.

Change android:Theme.Dialog to Light AppCompat Dialog

I'm using in my style.xml as main app theme
<style name="AppTheme" parent="Theme.AppCompat.Light">
And all AlertDialogs using same white/blue colors. But i have Activities which working as Dialog parent="android:Theme.Dialog" and this box use dark theme. How could I change it to AppCompat.Light theme?
I tryed Theme.AppCompat.Light.Dialog but as you know it doesn't working well.
Thanks.
You can use this theme:
<style name="AppTheme" parent="android:Theme.DeviceDefault.Light.Dialog">
Or this:
<style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light">
<!-- API 14 theme customizations can go here. -->
</style>
<style name="MyAppCompatDialogTheme" parent="AppBaseTheme">
<item name="android:windowIsFloating">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowSoftInputMode">stateAlwaysHidden</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
source last code

Categories

Resources