Reputation: 67
I'm having issues with the datepicker design. I'm having different design when I'm seeing it on eclipse screen and when I run it on emulator it shows me different design. Screenshots and code are below.
<DatePicker
android:id="@+id/added_date"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:calendarViewShown="false"
android:soundEffectsEnabled="false" />
Code which I'm using in values/styles.xml
. If I don't use this code I get a whole different datepicker.
<item name="android:datePickerStyle">@android:style/Widget.DatePicker</item>
Eclipse screenshot:
Emulator screenshot:
Upvotes: 1
Views: 385
Reputation: 6109
This is a result of the Android OS version you are running: the later is from 4.0 (or 3.x holo) and up, the the former is 2.x and below. The style is dependent on the os version: instead of relying on the sdk, you might use a third party library (where the style is defined and not dependent on the os version: look here https://android-arsenal.com/search?q=date+picker for what you might want.
Note you can change the style to reflect a particular os version in the preview, by looking for for the Android icon with the number next to it, and selecting which os version you want the preview to reflect.
If you don't want to use a third party library, you can force the style of the datepicker by rewritting the theme style, for reference check this post out: datepicker with different style than activity
Upvotes: 1