Android 造型采摘器安卓棉花糖
我正在为android日历样式而挣扎。事实证明,安卓6忽略了calendarTextColor,并使用textColorPrimary来设置日标签的样式,同时使用textColorSecondary来设置星期日的样式。我已经在android 5上检查了calendarTextColor,它工作正常。根据文档,textColorPrimary用作工具栏文本颜色。所以我的工具栏文本颜色是白色的,我收到白色背景上的白色日标签。如何在不触碰android api 23的textColorPrimary的情况下指定calendarTextColor?您可以为datepicker创建自定义主题,并在其中指定文本颜色 试试这个Android 造型采摘器安卓棉花糖,android,datepicker,styling,android-6.0-marshmallow,Android,Datepicker,Styling,Android 6.0 Marshmallow,我正在为android日历样式而挣扎。事实证明,安卓6忽略了calendarTextColor,并使用textColorPrimary来设置日标签的样式,同时使用textColorSecondary来设置星期日的样式。我已经在android 5上检查了calendarTextColor,它工作正常。根据文档,textColorPrimary用作工具栏文本颜色。所以我的工具栏文本颜色是白色的,我收到白色背景上的白色日标签。如何在不触碰android api 23的textColorPrimary的
<style name="datePickerTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:textColorPrimary">@color/colorBlack</item>
<item name="android:textColorSecondary">@color/colorBlack</item>
<item name="android:textColorTertiary">@color/colorBlack</item>
</style>
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
// TODO Auto-generated method stub
myCalendar.set(Calendar.YEAR, year);
myCalendar.set(Calendar.MONTH, monthOfYear);
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
String myFormat = "MM/dd/yy"; //In which you need put here
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);
calendar.setText(sdf.format(myCalendar.getTime()));
}
};
calendar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
new DatePickerDialog(YourActivity.this,R.style.datePickerTheme, date, myCalendar
.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
myCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
});
}