Can anyone suggest a good tutorial about how to create custom view?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I was asking myself the same question. Doing a searches on Google, I found some good info. First of all you should start by reading the documentation presented by Google Android:
- http://developer.android.com/guide/topics/ui/custom-components.html
After that, for general tutorials of a view that extends the android.view.View
class, these seem to be good examples:
- http://www.androidcompetencycenter.com/2009/08/creatingcustomviews/
- http://www.skill-guru.com/blog/2011/01/20/creating-a-custom-widgets-in-android/
As for using the android.view.ViewGroup
, there seems to be already some posts on the subject:
- How to use viewGroup in android
- custom ViewGroup example?
- Can anyone give a good example of a Custom ViewGroup containing a Custom View with measure and layout examples? (In Java)
回答2:
Custom View - HorizontalSlider | Hello Android
http://www.helloandroid.com/tutorials/custom-view-horizontalslider