Skip to content Skip to sidebar Skip to footer

How To Customize The Numberpicker

I found 2 built-in NumberPickers: (source: techbooster.org) By default, it's the first one, but when I add android:theme='@android:style/Theme.NoTitleBar' in AndroidManifest.xml

Solution 1:

The problem is that @android:style/Theme is the Android theme for devices on API version 10 (2.3) and lower.

If you want to keep Holo support, you should use @android:style/Theme.Holo.

If you need to support devices without Holo as well, you will need to create asset folders for those devices and specify the theme there.

Solution 2:

you are setting the non holo theme so you get the non holo numberpicker.

see this as reference, its basically the same thing you asked

Remove titlebar in xml

Solution 3:

You can use:

android:theme="@android:style/Theme.Holo.NoActionBar"

if you don't want to display the ActionBar and still get Holo-styled NumberPicker.

Solution 4:

Have a superclass named as BaseActivity which gets extended by all the activities in your app. In it's onCreate call this

requestWindowFeature(Window.FEATURE_NO_TITLE);

It'll remove the title bar from all of your activities and you can use whatever theme you want. The only drawaback you'll get is the title bar will appear for a fraction of second when launching your app, but won't be seen again.

Solution 5:

Additionally you can change also the following properties:

Your numberpicker definition in exampleActivity.xml

<NumberPicker
<!-- ... -->
android:background="@drawable/customshape" />

The drawable/customshape.xml

<?xml version="1.0" encoding="UTF-8"?><shapexmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"><gradientandroid:startColor="@color/numberpicker_color_range_start"android:endColor="@color/numberpicker_color_range_end"android:angle="270"/></shape>

solidColor ... is the main holo color and a background with a customshape to get additional coloring:

Post a Comment for "How To Customize The Numberpicker"