Android自定义数字图标向上、向下按钮背景
我要换号码。乘客的上下按钮 。。。我试过numberpicker.getchildat 但它返回空值 xml 我怎样才能上下改变numberpicker背景?Android自定义数字图标向上、向下按钮背景,android,numberpicker,Android,Numberpicker,我要换号码。乘客的上下按钮 。。。我试过numberpicker.getchildat 但它返回空值 xml 我怎样才能上下改变numberpicker背景? 请帮帮我:你为什么不使用android time picker?因为我不知道如何更改android numberpicker的上下btn背景。。 <LinearLayout android:layout_width="0dip" android:layout_height="match_parent" and
请帮帮我:你为什么不使用android time picker?因为我不知道如何更改android numberpicker的上下btn背景。。
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="10"
android:gravity="center">
<NumberPicker
android:id="@+id/mypage_hoursetting_np"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:divider="@null"/>
</LinearLayout>
mypage_hoursetting_np = (NumberPicker)view.findViewById(R.id.mypage_hoursetting_np);
mypage_minutesetting_np = (NumberPicker)view.findViewById(R.id.mypage_minutesetting_np);
...
public void setNumberpicker(){
View hour_upbutton = mypage_hoursetting_np.getChildAt(0);
View hour_text = mypage_hoursetting_np.getChildAt(1); // null
View hour_downbutton = mypage_hoursetting_np.getChildAt(2); // null
View minute_upbutton = mypage_minutesetting_np.getChildAt(0);
View minute_text = mypage_minutesetting_np.getChildAt(1); // null
View minute_downView = mypage_minutesetting_np.getChildAt(2); // null
mypage_hoursetting_np.setMaxValue(12);
mypage_hoursetting_np.setMinValue(1);
mypage_hoursetting_np.setWrapSelectorWheel(true);
mypage_minutesetting_np.setMaxValue(60);
mypage_minutesetting_np.setMinValue(1);
mypage_minutesetting_np.setWrapSelectorWheel(true);
Drawable alarmup_image = new BitmapDrawable(getActivity().getResources(), ImageDecoder.decodeSampledBitmapFromResource(getActivity().getResources(), R.drawable.mypage_alarmset_up_image, 200, 200));
Drawable alarmdown_image = new BitmapDrawable(getActivity().getResources(), ImageDecoder.decodeSampledBitmapFromResource(getActivity().getResources(), R.drawable.mypage_alarmset_down_image, 200, 200));
hour_upbutton.setBackground(alarmup_image);
//hour_downbutton.setBackground(alarmdown_image);
minute_upbutton.setBackground(alarmup_image);
//minute_downView.setBackground(alarmdown_image);
}