The first is to go down to the framework and find the relevant theme property.
At the beginning, the direct search was <item name= "Datepickerstyle" > @style/widget.funui.datepicker</item>, but, looking for the parent class, Does not find a valid attribute, there is just one layout
<item name= "Android:internallayout" > @android:layout/date_picker_holo</item> Properties, and then start here and see a layout
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:layout_gravity= "Center_horizontal"android:orientation= "Horizontal"android:gravity= "center" > <linearlayout android:id= "@+id/pickers"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_weight= "1"android:orientation= "Horizontal"android:gravity= "Center" > <!--Month--<Numberpicker Android:id= "@+id/month"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_margintop= "16dip"Android:layout_marginbottom= "16dip"Android:layout_marginstart= "8dip"Android:layout_marginend= "8dip"android:focusable= "true"Android:focusableintouchmode= "true"/> <!--day--<Numberpicker Android:id= "@+id/day"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_margintop= "16dip"Android:layout_marginbottom= "16dip"Android:layout_marginstart= "8dip"Android:layout_marginend= "8dip"android:focusable= "true"Android:focusableintouchmode= "true"/> <!--year--<Numberpicker Android:id= "@+id/year"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_margintop= "16dip"Android:layout_marginbottom= "16dip"Android:layout_marginstart= "8dip"Android:layout_marginend= "16dip"android:focusable= "true"Android:focusableintouchmode= "true"/> </LinearLayout> <!--Calendar View--<CalendarView Android:id= "@+id/calendar_view"Android:layout_width= "245dip"Android:layout_height= "280dip"Android:layout_marginstart= "16dip"Android:layout_marginend= "16dip"Android:layout_weight= "1"android:focusable= "true"Android:focusableintouchmode= "true"/></linearlayout>
Found that there is no control on the underline, and later felt that this should be related to Numberpicker , after entering, found that the control has an underscore in the drawing, and then again to theme under the property of the control, found a
<item name= "Numberpickerstyle" > @style/widget.funui.numberpicker</item> Go down this property and find the parent class, as follows
<style name= "Widget.Holo.NumberPicker" parent= "Widget.numberpicker" > <item name= "Android: Internallayout "> @android:layout/number_picker_with_selector_wheel</item> <item name=" Android: Solidcolor "> @android:color/transparent</item> <!--change the underline properties--
<item name= "Android:selectiondivider" > @android:d rawable/numberpicker_selection_divider</item> <item name= "Android:selectiondividerheight" >2dip</item> <item name= "Android: Selectiondividersdistance ">48dip</item> <item name=" Android:internalminwidth ">64dip</item > <item name= "android:internalmaxheight" >180dip</item> <item name= " Virtualbuttonpresseddrawable ">?android:attr/selectableItemBackground</item> </style>
And then we replaced this property in the framework, and it did, but when we tried to make a change in the app, we ran into another problem, that is, if we were to modify it as follows
<resources> <style name= "Settings.theme" parent= "Custom_settings_theme" > <item name= "Apnpreferenc Estyle "> @style/apnpreference</item> <item name=" Android:actionbartabtextstyle "> @style/ customactionbartabtextstyle</item> <item name= "Android:actionbarstyle" > @style/settingsbarstyle</ item> <item name= "Android:actionbartabstyle" > @style/settingsactionbartabview</item> <item Name= "*android:actionmenulandtextcolor" > #ffffff </item> <item name= "Android:actionmenutextcolor" >@ color/action_menu_text_color</item> <item name= "*android:homeasupindicator" > @drawable/ic_ab_back_ holo_dark_am</item> <item name= "wifi_signal" > @drawable/wifi_signal_light</item> <item N Ame= "Android:windowfullscreen" >true</item> <item name= "Android:switchstyle" > @style/myswitchstyle</item> <item name= "Androi D:listchoiceindicatorsingle "> @drawable/btn_radio_funui</item> <item name=" Android: Listchoiceindicatormultiple "> @drawable/btn_check_funui</item> <item name=" Android:alertdialogtheme "& gt; @style/settings.theme.alterdialog</item> <!--settings Picker style-->
<item name= "*android:numberpickerstyle" > @style/settings.theme.numberpicker</item> </style> < Style name= "Settings.Theme.NumberPicker" parent= "@*android:style/widget.funui.numberpicker" > <item name= "*an Droid:selectiondivider "> @drawable/numberpicker_selection_divider</item> </style>
At this point you will find that our setup does not work and then replace the second
That is, when you create picker in your code, you pass in a property
New Timepickerdialog (This is, Mhour, Mminutes, Dateformat.is24hourformat (This)). Show ();
At this point you will find that there is a problem, that is the time to bounce out, do not have dialog style, that is, your properties filter out the dialog style, because in the final analysis, this timepickerdialog outer layer is a dialog
Finally listened to the colleague's method, the perfect solves the question, that is, in the dialog attribute inside adds Timepickerdialog's style, as follows
<?xml version= "1.0" encoding= "Utf-8"?><resources> <style name= "Schedulepoweronoff.theme" parent= "@ Android:style/theme.funui "> <item name=" Android:windowfullscreen ">true</item> <item name= "Android:actionbarstyle" > @style/actionbar_def_style</item> <item nam E= "Android:listchoiceindicatormultiple" > @drawable/btn_check_funui</item> <item name= "Android: Switchstyle "> @style/myswitchstyle</item>
<!--This is the key, the excessive properties that are acting on picker-
<item name= "Android:alertdialogtheme" > @style/schedulepoweronoff.theme.alertdialog</item><!-- Dialog The Picker property of the outer layer has an effect--
<item name= "*android:numberpickerstyle" > @style/schedulepoweronoff.theme.numberpicker</item> </st yle> <style name= "Myswitchstyle" parent= "@*android:style/widget.funui.compoundbutton.switch" > <item Name= "Android:track" > @drawable/switch_track_funui</item> </style> <style name= " SchedulePowerOnOff.Theme.AlertDialog "parent=" @*android:style/theme.funui.dialog.alert "> <item name=" Android:listchoiceindicatorsingle "> @drawable/btn_radio_funui</item> <item name=" Android: Listchoiceindicatormultiple "> @drawable/btn_check_funui</item> <item name=" *android:numberpickerstyle "> @style/schedulepoweronoff.theme.numberpicker</item> </style> <style name=" Actionbar_def_style "Parent=" @android: Style/widget.funui.actionbar "> <item name=" android:displayoptions ">homeasup|showtitle </item> <item name= "Android:background" > #b54cff </item> </style> <style name= "SchedulePowerOnOff.Theme.NumberPicker" parent= "@*android:style/ Widget.Funui.NumberPicker "> <item name=" *android:selectiondivider "> @drawable/numberpicker_selection_ divider</item>
<!--the width of the underline--
<item name="Android:selectiondividerheight">0.5dip</Item>
</style></resources>
In fact, you will find that all similar situations can be solved in this way, that is, if a control contains other controls that want to change the inner control in theme, it must be modified in his outer layer. Note that at this time his parent class integrates the theme.
Android-timepickerdialog Underline Color Modification