I've started my app with these two examples in mind:
http://code.google.com/p/iosched/
http://developer.android.com/resources/samples/HoneycombGallery/index.html
It currently has
minSdkVersion = 8 minSdkTarget = 11
set up in my manifest. I've tried everything I can think of, but can't seem to get the styling I want. I've accomplished a lot of styling, but one thing eludes me still...the tabs. I can't find any way to color them.
Now before I get too far, and before you tell me I missed something obvious, is it even possible to change the colors of the tabs on Android 3.1...or even 3.0 for that matter (the normally bright blue underlines)? It seems I can do most everything else...
I've looked all over for the answer. Including these places and many, many more...
http://developer.android.com/guide/topics/ui/actionbar.html
http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html
http://developer.android.com/resources/samples/ActionBarCompat/index.html
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Android 3.0 ActionBar, changing colors
Android action bar like twitter sample
Android ActionBar tab style for Honeycomb
http://groups.google.com/group/android-developers/browse_thread/thread/983509d7261c54f4
If nothing else, this is a decent list of links for those looking...
Thanks
<style name="MyTheme.Light" parent="#android:style/Theme.Holo.Light">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarTabStyle">#style/customActionBarTabStyle</item>
<item name="android:actionBarTabTextStyle">#style/customActionBarTabTextStyle</item>
</style>
<style name="customActionBarTabTextStyle">
<item name="android:textColor">#android:color/white</item>
</style>
<style name="customActionBarTabStyle">
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">24dp</item>
<item name="android:paddingRight">24dp</item>
</style>
I don't think you can change the fine blue line colors.
Related
After updating old android project to be able to build project with Android Studio 3.2.1, all popups became white.
All AlertDialog, ProgressDialog, Spinner got white background and white text.
If i change theme in the app, some text become readable but whiteness persist.
I solved some of them by hacks like this:
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.DKGRAY));
but this doesn't work everywhere.
What can be the cause?
This is first time i work with android in seven year, i was doing iOS before, so this is new territory for me.
Update:
Comments helped to pinpoint that issue was regarding themes.
Now, challenge was digging out what was causing white backgrounds.
I had to set parent to my custom attribute:
parent="Base.Theme.AppCompat"
So in my custom theme there was this attribute: android:alertDialogTheme
<style name="CustomMobileTheme.Base.Black" parent="Base.Theme.AppCompat">
<item name="android:alertDialogTheme">#style/Theme.AppCompat.Dialog.Alert</item>
<item name="android:colorPrimary">#color/actionBarColorBlackTheme</item>
<item name="android:statusBarColor">#000000</item>
That was making all this mess. I have no idea what android:alertDialogTheme does, it is not specified in Spinner documentation and i had to manually comment out about 200 attributes in the theme, to dig out this culprit and spend about 13 hours of my private time. I wish to the developer who made this suffer some bad karma.
All AlertDialog, ProgressDialog, Spinner got white background and white text.
It may Becuase of "colorAccent" in your application theme is white.
Please check your theme for "colorAccent". If not specified then please specify with color which you want. check below code.
<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">#color/colorAccent</item>
</style>
I'm starting my second Android app and find that I would like to mostly use HOLO dark theme for app.
EXCEPT for the EditTexts, I would prefer to use the old Gingerbread style ones (looking closer to iOS) with some rounded corner.
I'm a bit lost as to how I can achieve this. If anyone could drop some hints or links that would be HIGHLY appreciated
In your Theme:
<style name="myTheme" parent="android:Theme.Holo">
<item name="editTextStyle">#style/MyWidget.EditText</item>
</style>
<style name="MyWidget.EditText" parent="android:Widget.EditText">
<item name="android:background">#drawable/edit_text</item>
</style>
Now you can get the referenced drawable from Github(from the Gingerbread branch of the framework)
The application I've been developing uses ActionBarSherlock, and the main theme inherits from Theme.Sherlock.Light.DarkActionBar. The design requires that the overflow menu popups have a dark coloured background and white text. This works fine for devices without a physical menu button, and the text appears white as intended. However, if the device DOES have a physical menu button, the text shown in the menu displayed remains black.
My main theme contains
<item name="android:panelBackground">#drawable/menu_hardkey_panel</item>
...Where #drawable/menu_hardkey_panel is a dark coloured 9patch.
The resulting appearance of the menu popup is...
I'm unable to determine why this is happening, or how to manually change the colour of the text. In my main theme, I've tried all of the following...
<item name="android:actionMenuTextColor">#android:color/white</item>
<item name="android:textAppearanceLargePopupMenu">#style/MyMenuTextAppearance.Large</item>
<item name="android:textAppearanceSmallPopupMenu">#style/MyMenuTextAppearance.Small</item>
I've even tried
<item name="android:actionBarWidgetTheme">#style/Theme.MyApp.Dark</item>
...Where Theme.MyApp.Dark is...
<style name="Theme.MyApp.Dark" parent="#style/Theme.Sherlock">
<item name="android:dropDownListViewStyle">#style/DropDownListView</item>
<item name="dropDownListViewStyle">#style/DropDownListView</item>
</style>
None have let me change the text to white. If I make my base theme inherit from Theme.Sherlock, the problem is solved and the text is white, but unfortunately that's not an option.
Not entirely sure about this, but I believe the pop-up menu uses the same styling as the overflow menu. In which case you'd just do something like this.
<item name="android:itemTextAppearance">#style/your_new_text_appearance</item>
<style name="your_new_text_appearance">
<item name="android:textColor">#android:color/white</item>
</style>
Giving it a chance: there is a text appearance called actionMenuTextAppearance. Have you tried that?
Update: I did some more digging and I believe that this file is the layout And there they refer to textAppearanceListItemSmall and textAppearanceSmall. However, it takes this value from a special theme which is specified as following in Theme.Holo.Light
<item name="panelMenuListTheme">#android:style/Theme.Holo.Light.CompactMenu</item>
And like this in Theme.Holo:
<item name="panelMenuListTheme">#android:style/Theme.Holo.CompactMenu</item>
The problems comes from the fact that the parent of Sherlock.__Theme.DarkActionBar is Theme.Sherlock.Light. This is not valid for the dark action bar. Taking the line from Theme.Holo should do the trick.
In my research I haven't found a way to change the text color, but you can at least handle hardkey menus gracefully.
This link provided me with a passable solution to the problem:
https://github.com/jgilfelt/android-actionbarstylegenerator/issues/30
Commenting out the "android:panelBackground" item from my generated theme allowed the text to at least be visible on hardkey menus, even if it doesn't perfectly match the theme.
You could also try replacing the "menu_hardkey_panel_whatever.9.png" drawable with something that will work for your theme and the black text.
For me this solves the problem, try this instead:
<style name="MyTheme" parent="Theme.Sherlock.Light.DarkActionBar">
...
<item name="actionBarWidgetTheme">#null</item>
<item name="android:actionBarWidgetTheme">#null</item>
...
</style>
I found the solution, use:
getSupportActionBarContext()
e.g.
ArrayAdapter<CharSequence> list =
ArrayAdapter.createFromResource(getSupportActionBarContext(), R.array.navigation, layout.simple_spinner_item);
list.setDropDownViewResource(layout.simple_spinner_dropdown_item);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setListNavigationCallbacks(list, this);
I think that due to the fact that Theme.Sherlock.Light.DarkActionBar don't style its contents right is due to the actionWidgetTheme attribute is used with a ContextThemeWrapper for inflating the action bar views (Jake Wharton's own words), thus something like the following (not tested) will be needed to fulfill your needs, though breaking your need of not using Theme.Sherlock as parent in one way:
<style name="MyColorTheme" parent="Theme.Sherlock">
<item name="android:actionMenuTextColor">#android:color/white</item>
<item name="actionMenuTextColor">#android:color/white</item>
</style>
<style name="YourMainTheme" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="android:actionMenuTextAppearance">#style/MyColorTheme</item>
<item name="actionMenuTextAppearance">#style/MyColorTheme</item>
</style>
Might work or not work. That's the question :)
I am using the ActionBarSherlock and almost everything seems to work fine.
But I want the title text color in white. When using the Sherlock-Actionbar it works fine but not with the original ActionBar in Android 4
In an act of desperation I tried this:
<style name="Widget.AppTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
<item name="titleTextStyle">#style/TextAppearance.AppTheme.Widget.ActionBar.Title</item>
<item name="android:gravity">center</item>
<item name="android:background">#color/white</item>
<item name="android:textColor">#color/white</item>
</style>
and found that the background changed as told to white. So this is obviously the right place to change. But still changing the textColor to white doesn't work for me.
I'm using this as my Theme:
<style name="AppTheme" parent="Theme.Sherlock.Light">
<item name="android:actionBarStyle">#style/Widget.AppTheme.ActionBar</item>
<item name="actionBarStyle">#style/Widget.AppTheme.ActionBar</item>
<item name="textColorPrimary">#color/white</item>
<item name="android:textColor">#color/white</item>
...
</style>
So any idea what could be the problem? Why is it working with the background but not with the textColor?
Thanks,
Tobias
--- EDIT FROM HERE ---
I just found out that if I use my theme programmaticall like
setTheme(R.style.Widget_AppTheme_ActionBar);
It works. But if I rely on the settings I have in my Manifest it doesn't.
<application ... android:theme="#style/AppTheme" >
but
<application ... android:theme="#style/Widget_AppTheme_ActionBar" >
would do fine - even though the other styles from the AppTheme wouldn't be set.
So it looks like using a theme that defines an own ActionBarStyle doesn't work.
Has anyone any idea?
Okay, sorry for answering my own question. I eventually realized my problem.
Of cause I have to use these two arguments
<item name="titleTextStyle">#style/TextAppearance.AppTheme.Widget.ActionBar.Title</item>
<item name="android:titleTextStyle">#style/TextAppearance.AppTheme.Widget.ActionBar.Title</item>
Since the first one is working for Android 2.x with the ActionBarSherlock and the second one is doing the same for the native Action Bar.
I hope this helps someone who has the same trouble as I had.
I have been searching for the solution for the last several days but could not find one.
I need to change the background color of the right pane (I know how to change the color of the left parent preference). I created a new theme in manifest file.
<activity android:name=".PreferenceWithHeaders"
android:label="#string/app_name"
android:theme="#style/PreferencesTheme">
</activity>
Below is the PreferencesTheme portion of styles.xml
<style name="PreferencesTheme" parent="android:Theme.Holo">
<item name="android:windowBackground">#drawable/background</item>
</style>
I am, however, unable to change the default gray background color of the child PreferenceScreenwhich is on the right. Please take a look at the picture.
I tried different things but they don't have any impact on the background color. Any pointers will be deeply appreciated!
I had this same issue not long ago; couldn't figure it out at the time, even after trying many of the solutions here. Finally stumbled upon a fix after running into a similar issue.
I just finished writing a blog post about it that explains in more detail, Fixing empty white space issues with Android ListViews, but basically you should be able to get rid of the white space by setting overScrollFooter to #null.
As overScrollFooter is only available in Android 2.3.3+ (API Level 10+), you'd have something like this:
res/values/styles.xml
<style name="MyListView" parent="#android:style/Widget.ListView">
</style>
res/values-v10/styles.xml
<style name="MyListView" parent="#android:style/Widget.ListView">
<item name="android:overScrollFooter">#null</item>
</style>
And of course update your PreferencesTheme to use it:
<style name="PreferencesTheme" parent="android:Theme.Holo">
<item name="android:windowBackground">#drawable/background</item>
<item name="android:listViewStyle">#style/MyListView</item>
</style>