How to change the timepicker style? - android

Hi I have a question about TimePicker in Android.
I've followed this guide to create a time picker. It works however the problem is that I want to have a time picker which has scrollable option, like in this one, rather than have you to press + or - to change the time.
I've looked around in the page and in the code and cannot understand how to change it into a scrollable picker.

what i did is added library app_compatv7
and added
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 11 theme customizations can go here. -->
</style>
and add the theme to the manifest.xml so u will get new date picker

Related

Adding Android styles to Appcelerator View

I'd like to add styles defined in /app/platform/android/res/values to an appcelerator Button.
<style name="textAppearanceButton" parent="#android:style/TextAppearance.Material.Widget.Button">
<item name="android:textAllCaps">false</item>
</style>
When I use this code, it will apply to all buttons - which i don't want.
Is it possible to add it on selected buttons?
At the moment this is not possible. I did create a feature request for this some time ago that you can watch to show your interest:
https://jira.appcelerator.org/browse/TIMOB-19904

Android number picker style

I have the following problem : I want to use Theme.NoTitleBar.Fullscreen for my application parrent theme, but with this theme the number picker looks in the older way (with "+" and "-"), but I want to looks like the new way (with the blue dividers). Is there a way to achieve this? It will be sad (and I will lose a lot of time) to write my own picker only, because of the theme ? I will be glad if someone has simple solution. I google it but I insist to not change the style, because the application was always with this style and it will be strange to change the whole style only for that.
Thanks in advance.
P.S. I try not to make this theme parent theme and just to copy
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
this properties in my theme, but then application is not in full screen i.e. not working properly (like with make Theme.NoTitleBar.Fullscreen parent theme ) .
P.S.2 There is Theme.Holo.NoActionBar.Fullscreen and I thing it should work, but I'm not sure what is the difference between it and Theme.NoTitleBar.Fullscreen.
I will be glad if someone enlighten me.

android-How to use dark theme for dialog on api8+

this is the dialog I have right now :
as you can see, it's white . How can I use dark theme for this dialog ? I want to make it dark .
I'm using appcompact and I want it to work on api+8 .
I'm sorry to simply link to a library, but that's the only way I know to make that work on such old API levels.
library:AlertDialogPro#github (API 7+)
<style name="YourAppTheme">
<item name="alertDialogProTheme">#style/Theme.AlertDialogPro.Material</item>
</style>
A README and a demo application is included.

Android spinner with date picker, like Google Calendar app

I'm trying to get a text box that looks like a spinner to activate a date picker dialog. This is done in both the Google Calendar app and the Contacts app (for birthdate) on ICS. Do I need to use a spinner, and if so how do I change it's input view to be a date picker? Or if not, how do I get a text view to have the little triangle that usually indicates a spinner?
Twaddington's comment on his answer is actually the right approach.
What you need is to create a text view and apply the style
style="#android:style/Widget.DeviceDefault.Light.Spinner"
Then you can create a click listener on the text view and use it to open a DatePickerDialog. That can be accomplished as shown here: https://stackoverflow.com/a/8127571/332738
(If you follow the example, remember to add a default constructor to DatePickerDialogFragment so that your app does not crash on rotate)
I don't know if you still need this. But in the Contacts app, it is achieved with the following:
<Button
...
style="?android:attr/spinnerStyle"
... />
This should work over all Android versions, as it is available since api level 1:
http://developer.android.com/reference/android/R.attr.html#spinnerStyle
I'm not sure if this is what you're asking, but you should be able to follow the Date Picker tutorial on the Android developer website.
Also, the DatePicker and DatePickerDialog classes might be worth a look.
I would prefer below theme for Spinner like google contacts.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:spinnerStyle">#style/AppTheme.Form.Spinner</item>
<item name="android:spinnerItemStyle">#style/AppTheme.Form.Spinner.Item</item>
</style>
<!-- Spinner Styles -->
<style name="AppTheme.Form.Spinner" parent="Widget.AppCompat.Spinner">
<item name="android:paddingRight">0dp</item>
<item name="android:paddingEnd">0dp</item>
</style>
<style name="AppTheme.Form.Spinner.Item" parent="Widget.AppCompat.EditText">
<item name="android:clickable">false</item>
</style>
</resources>

Text color doesn't change in an AlertDialog when applying an app wide theme

(Note: build minimum and target API 7)
Ok, here is a real stumper for this newbie between the chair and the keyboard:
I am applying a them to my app, and using AlertDialog for some key information at a few key places (i.e. a EULA pop up on first app run). My problem is this, everything is fine until I apply a theme (or style to the Activity). My text everywhere but the pop ups formats correctly. The problem is that I am changing from the default white text on black back ground to black text on white background. The background changes on the pop ups but not the text, so the net effect is that I have a white pop up with the text there (scroll bars show for the long winded EULA) but the text is unreadable because it is the exact same color as the background.
Here is the my_style.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="main">
<item name="android:background">#FFFFFF</item>
<item name="android:textColor">#000000</item>
<item name="android:typeface">sans</item>
</style>
</resources>
I know I am implementing the call correctly because everything else in the app formats correctly, what am I missing? The app works just fine when the android:theme="#style/main" is removed from the <application> tag in the manifest file (formating removed from the entire app and the dialogs are readable). Thanks for getting a newbie set straight.
Have you passed the theme to AlertDialog's or AlertDialog.Builder's constructor when creating the dialog?
See here.

Categories

Resources