Mixing Android widget old & new themes - android

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)

Related

Material Design custom view theme

I am trying to have a default theme with a button. When I do this the button no longer ripples. I believe I need to set a proper parent on the btn_normal style but I can not find the appropiate theme.
btn_normal style works fine if I just apply it via a style to the button directly.
I have tried tons of parents and none of them have worked. Let me know if you have ran into this. Thanks.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:buttonStyle">#style/btn_normal</item>
</style>
<style name="btn_normal">
</style>
You should use RippleDrawable third party library. By that, you can give Ripple effect for Android 7+ version.

How to fix styling of app

I am having a really hard time with the styling of my Android application, check out the screenshot:
The screenshot is from a Android 4.0.3 emulator, so I expect the new looks.
There are several problems with it:
The black border around the title of the alert dialog
The blue border around the whole alert dialog
The NumberPicker looks like Android 2.0
The buttons should be black and with no space between them and the border of the dialog
My Styles.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Splash" parent="android:Theme">
<item name="android:windowBackground">#drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.Recson.BlueBackground" parent="android:Theme">
<item name="android:background">#ff2390C8</item>
</style>
<style name="Theme.Recson.NoActionBar" parent="Theme.Recson.BlueBackground">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
The activity that spawns this alert dialog uses Theme.Recson.BlueBackground. Not specifying any theme for the activity makes it look the way I want it to - except for the missing blue background:
So, I guess, the question is: How to fix my theme?
Try using parent="android:Theme.Holo".
Of course, this is only available from API level 11 and up, so you will have to create a separate styles.xml file and place it in the values-v11 folder.
In the default styles.xml file use your existing configuration, in the v11 file, you can use Theme.Holo.
Have a look at Styles and Themes - Select a theme based on platform version | Android Developers.

Android: Theme.Holo.Light.NoActionBar vs Theme.Light.NoTitleBar

In res/values-v11/styles.xml, I can't use Theme.Holo.Light.NoActionBar because it was added in API level 13. Can I use Theme.Light.NoTitleBar instead, with no visual differences? As far as I can tell, they should both have a white background, status and navigation bars, and nothing else.
Theme.Light.NoTitleBar is slightly different. The easiest way to resolve this and stay compatible back to Honeycomb is to create your own style that extends Theme.Holo.Light, but removes the Action Bar. Just create a style with the following definition:
<style name="MyTheme" parent="android:Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
As far as I know, the Theme.Light.NoTitleBar is based on older API level. You will get the style of Android 2.3. But Theme.Holo.Light.NoActionBar can give you the style of 4.0 or upper.

How to change background color of child preference screen in honeycomb

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>

Need a definitive answer for styling Android ActionBar tabs

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.

Categories

Resources