视图和小部件之间有什么区别? [英] What is the difference between Views and widgets?

查看:135
本文介绍了视图和小部件之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我没记错的话, View 是所有小部件的超类,但是如何区分View和小部件?例如,按钮或文本框,我应该怎么称呼它们(视图或窗口小部件)?

解决方案

调用它们之一就可以了.

我倾向于将术语"widget"用于 View 的子类,这些子类默认情况下对用户具有可视化的表示形式-例如 TextView Button ListView

我倾向于将术语视图"用于 View 任何子类,包括诸如 LinearLayout 之类的纯容器./p>

但是,再次强调,用这两个术语来称呼它们都没有特别的危害.

If I am not wrong, View is the superclass for all widgets, but how do I differentiate between a View and a widget? For example, a button or a text box, what should I call them (a View or a widget)?

解决方案

Calling them either is fine.

I tend to use the term "widget" for subclasses of View that have a visual representation to the user by default -- things like TextView, Button, ListView, etc.

I tend to use the term "view" for something that could be any subclass of View, including pure containers like LinearLayout.

But, again, there is no particular harm in referring to them by either term.

这篇关于视图和小部件之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆