Android HoneyComb DatePicker Text Color

后端 未结 5 1925
小鲜肉
小鲜肉 2020-12-03 14:25

I\'m searching for a possibilitie to adjust the text color of the datepicker widget in an android honeycomb app. I knew that the widget inherent the global text-color which

5条回答
  •  萌比男神i
    2020-12-03 14:52

    I have found this solution: debugging DatePicker object, I get the object jerarqy. Maybe it's not an elegant solution but it works:

        private void setNumberPickerProperties(DatePicker dp)
    {
            LinearLayout l = (LinearLayout)dp.getChildAt(0);
            if(l!=null)
            {
                    l = (LinearLayout)l.getChildAt(0);
                    if(l!=null)
                    {
                            for(int i=0;i<3;i++)
                            {
                                    NumberPicker np = (NumberPicker)l.getChildAt(i);
                                    if(np!=null)
                                    {
                                            EditText et = (EditText)np.getChildAt(1);
                                            et.setTextColor(Color.BLACK);
                                    }
                            }
                    }
            }
    }
    

提交回复
热议问题