I have an activity that uses Theme.Holo.Light containing EditText, RadioButtons and DatePicker. I want to use Theme.Holo.Light for entire activity, except DatePicker which I want to be Theme.Light style. How can I do this?
Have you tried something like
<DatePicker
...
style="#android:style/Widget.DatePicker"/>
?
Holo uses #android:style/Widget.Holo.DatePicker while #android:style/Widget.DatePicker is the one you need to use.
Links:
Style list
Style list's source code
Update:
It seems that DatePicker is built with 3 NumberPickers. My answer is correct, but it is incomplete. The best approach I found to solve your problem was to recreate ans make your own DatePicker (copypaste from source code) and give style to the DatePicker AND the 3 NumberPickers inside.
Link of the Layout on GitHub:
DatePicker Layout
Related
Not just DatePicker and TimePicker, but a lot of dialogs I use from third party libraries look like this ever since I switched to material design:
Even when using android themes like HoloDark. I've tried changing buttonBarPositiveButtonStyle in the style and a few more related attributes, but none work. I assume the issue is they're using material buttons now which use different styling. But has anyone figured out a way to fix this? Thanks
EDIT: Just to clarify the issue is the button background being right next to eachother and not being transparent. Either adding a slight margin or making the buttons transparent will do for me
you can use your customButton and applay custombutton style
Turns out adding
<item name="android:buttonBarPositiveButtonStyle">#style/Widget.MaterialComponents.Button.TextButton.Dialog</item>
to my theme fixed the issue
Is there a way to replicate the color changing ability provided by QKSMS .
It allows a user to select a color and then changes the app color and everything to that color.This is all done dynamically the moment the user chooses a specific color.
You can try this cool online tool: http://android-holo-colors.com
This enables you to create many themes for app widgets with your preferred color. You can then change your app theme by saving values for your theme in SharesPreferences or something similar and apply them in onCreate of each activity you have in your app. You can also create the themes easily in styles.xml. For each view, it has its own style with its own attributes so you will need to learn how to edit the theme of each view you want by searching...
Hope that helps.
Some Examples:
ActionBar:
https://developer.android.com/training/basics/actionbar/styling.html
Buttons:
https://www.androidcookbook.com/Recipe.seam?recipeId=3307
SeekBar:
Android - styling seek bar
Switch:
How can I style an Android Switch?
And a lot more... You will have to search for what you want.
How can I change Timepicker Style to whee?
When I make Timepicker in my layout
like this
but I want this style
i know that is default style. I don't know how I can change the timepicker style
what can I do?
That is because you use old api (lower than ICS 4.0). To use the new styled TimePicker import SimonVT's TimePicker library. It has exactly the same style, that android > 4.0 TimerPicker has. It can be used starting from Android 2.1.
Use wheel picker library. You can style it any way you like and there is no limit to the type of content you can put in it. It's written by a Google Developer and I've used it in the past with no issues. I think it's compatible for Android 2.1+.
I have read lots of articles, here and elsewhere about customizing AlertDialogs, and those created by AlertDialog.Builder.
The approach that I'm using at the moment is injecting my AlertDialog.Builder with a ContextThemeWrapper. This ContextThemeWrapper is configured to read from a custom style that inherits from Theme.Dialog.
My customization requirements are quite straightforward:
Change the title bar background colour from the default navy/black version
Change the font type and size of both title and buttons
I've had a look in the default themes.xml and styles.xml but I don't see where to configure number 1 in particular...can someone let me know how this is done?
Also, some of the solutions I've seen involve inflating a layout and then setting this using AlertDialog.Builder.setView()...if I was to customize using this way then how do I design the views for positive and negative buttons?
Thanks
Sorry, alert dialogs are not really intended to be themed like that. They are basically the most concrete thing you can do -- a canned appearance for standard common situations.
If you want to have a dialog with a customized appearance, you should just start with the Dialog class.
I am new to Android app. development. I need to change the existing style at runtime or can create new styles at runtime and I need to apply it for my buttons and textviews..
Can any one suggest me?
There are several methods to do so (most of them are provided by the super class TextView):
setTextColor to change the color of foreground
setTypeface to change the font style
setBackgroundResource(int) to change its backgrond
setPadding to add padding
All of them work for EditText, Button and others, since most of them extends the TextView class. So, my suggestion is: RTFM... just kidding... read the documentation to see the available functions.
Yesterday I was trying to do something similar.
This links gave me enough info:
Building Custom Components
Custom Android Button Style and Theme
Understanding Android Themes And Styles