Giter VIP home page Giter VIP logo

pickerview's People

Contributors

duanhong169 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pickerview's Issues

Colors do not correspond with application theme

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))
        }
    }
}

PickerView

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);
                    }
                };
            }

这个地方需要修改,否则日期显示不准确

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.