如何在 Android 中创建自定义控件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1046256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I create custom controls in Android?
提问by SvenFinke
I would like to create a custom control in my Android App. It will be a circular control with some smaller moveable circles that will indicate a specific value.
我想在我的 Android 应用程序中创建一个自定义控件。它将是一个圆形控件,带有一些较小的可移动圆圈,用于指示特定值。
Is there a way to realize this?
有没有办法实现这一点?
Are there at least some nice tutorials where I can read how to create a custom control?
是否至少有一些不错的教程可以让我阅读如何创建自定义控件?
回答by Josef Pfleger
Have a look at the custom componentssection of the Android Dev Guide. The usual approach is to extend a View
and override applicable methods.