duanhong169 / pickerview Goto Github PK
View Code? Open in Web Editor NEW🕘 Android滚动选择器(省市区联动选择、日期选择、时间选择)
License: Apache License 2.0
🕘 Android滚动选择器(省市区联动选择、日期选择、时间选择)
License: Apache License 2.0
Hi How can I Set Custom typeface to item of pickerView???
First of all, I would like to thank you for this amazing library. It is the best PickerView
I found so far. There is only one problem.
When I use PickerView
with dark theme, topMask
and bottomMask
are not set correctly. Please set those fields to value corresponding with actual theme. You will need to add something like this:
TypedValue typedValue = new TypedValue();
if (resolveAttribute(android.R.attr.windowBackground, typedValue, true)) {
int[] gradientColors = {typedValue.data, Color.TRANSPARENT};
topMask = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, gradientColors);
bottomMask = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, gradientColors);
}
Or make those fields public. In the meantime, I am forced to use this ugly workaround (reflection):
fun Resources.Theme.fixPickerViewsMask(vararg pickerViews: PickerView) {
val typedValue = TypedValue()
if (resolveAttribute(android.R.attr.windowBackground, typedValue, true)) {
val gradientColors = intArrayOf(typedValue.data, Color.TRANSPARENT)
val topMask = PickerView::class.java.getDeclaredField("topMask")
topMask.isAccessible = true
val bottomMask = PickerView::class.java.getDeclaredField("bottomMask")
bottomMask.isAccessible = true
for (picker in pickerViews) {
topMask.set(picker, GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, gradientColors))
bottomMask.set(picker, GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, gradientColors))
}
}
}
datePickerView 设置最后的日期是当前日期,请问怎么设置?
PickerView setAdapter(pickAdapter)的时候 一直说我这个adapter==null
就是选中的时候上下两条灰色的线
@Override
public PickerView.PickerItem getItem(int index) {
final Calendar tempCalendar = (Calendar) startDate.clone();
tempCalendar.add(Calendar.DAY_OF_YEAR, index);
return new PickerView.PickerItem() {
@Override
public String getText() {
if (TimeUtils.isToday(tempCalendar)) {
return "今天";
}
return TimeUtils.date(tempCalendar);
}
};
}
这个地方需要修改,否则日期显示不准确
项目主体风格是紫色,但背景一直是白色,这俩颜色放一起不美观呀
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.