How to use NumberPicker in Android app with API 7?

被刻印的时光 ゝ 提交于 2019-12-10 13:22:37

问题


The minimum sdk of my app is 7, but I can use DialogFragment which is from sdk version 11, because it is in the support library which is in my lib directory.

I'd like to make something like this example: http://developer.android.com/guide/topics/ui/controls/pickers.html

But I want to use the NumberPicker widget, which is from sdk version 11 too, but my app does not allow this. Do I have to add other support library?

How can I use this component?

Thank you.


回答1:


Do I have to add other support library?

The Android Support library does not offer NumberPicker. Other people have created their own backports of NumberPicker that you could use, such as SimonVT's one.




回答2:


To those that want to support a number picker all the way back to Froyo at least, without using a third-party library or writing your own implementation, you can use the source code of the NumberPicker written by Romain Guy used in the AOSP Messaging app on Github. View my answer on this post for a link to the code.



来源:https://stackoverflow.com/questions/13494132/how-to-use-numberpicker-in-android-app-with-api-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!