Поскольку Android SDK не позволяет изменять элементы внутри timepicker. Вам нужен способ взлома. Для текста текста вам необходимо изменить тему. Вот небольшой пример в моем фрагменте. акцент делается на «R.style.Picker_Black», я установил тему в «Theme.Holo.Light», чтобы показать «черный» цвет текста в timepicker.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.Picker_Black);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View v = localInflater.inflate(R.layout.fragment_booking, container, false);
return v;
}
Определить стиль в "style.xml"
<style name="Picker.Black" parent="android:Theme.Holo.Light">
<item name="android:editTextStyle">@style/Widget.EditText.White</item>
</style>
Для делителем:
public class CustomTimePicker extends TimePicker {
public CustomTimePicker(Context context) {
super(context);
init();
}
public CustomTimePicker(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public CustomTimePicker(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
removeAllDividers(this);
}
private void removeAllDividers(ViewGroup picker) {
for (int i = 0; i < picker.getChildCount(); i++) {
View view = picker.getChildAt(i);
if (view instanceof NumberPicker) {
try {
Field field = NumberPicker.class.getDeclaredField("mSelectionDivider");
field.setAccessible(true);
field.set(view, null);
} catch (Exception e) {
}
} else if (view instanceof ViewGroup) {
removeAllDividers((ViewGroup) view);
}
}
}
}
Столбец или что? Я также хотел бы знать, возможно ли это. –