In an Android application, the user interface is built using View and ViewGroup objects. There are many types of views and view groups, each of which is a descendant of the View class.
View objects are the basic units of user interface expression on the Android platform. The View class serves as the base for subclasses called "widgets," which offer fully implemented UI objects, like text fields and buttons. The ViewGroup class serves as the base for subclasses called "layouts," which offer different kinds of layout architecture, like linear, tabular and relative.
A View object is a data structure whose properties store the layout parameters and content for a specific rectangular area of the screen. A View object handles its own measurement, layout, drawing, focus change, scrolling, and key/gesture interactions for the rectangular area of the screen in which it resides. As an object in the user interface, a View is also a point of interaction for the user and the receiver of the interaction events.
以上一段是google官方对android user interface的介绍。
首先看
In an Android application, the user interface is built using View and ViewGroup objects.
我的理解是这样的:
用户界面是构建在"View"和"ViewGroup"对象之上的。这里我的疑问是
:View 对象是何物?是不是可以这样理解:
class View()
{
//properties
....
//methods
....
}
这只是一个类,按照我对面向对象模糊的认识:应该由这个类生产一个对象
View view = new View();
这样,似乎就做出了一个view对象,不知可否这样理解呢?我觉得这样的理解肯定是不对的。换句话说:这里的“对象”二字该如何解释?
对于"ViewGroup",有着同样的疑惑。
接着往下看:There are many types of views and view groups, each of which is a descendant of the View class.
这句话说的是什么呢?View类的后代有很多类型的"views"和"view groups"?我无法理解。
继续看:
View objects are the basic units of user interface expression on the Android platform. The View class serves as the base for subclasses called "widgets," which offer fully implemented UI objects, like text fields and buttons. The ViewGroup class serves as the base for subclasses called "layouts," which offer different kinds of layout architecture, like linear, tabular and relative.
这一段的大概意思是说:View对象是Android平台用户界面的基本单元,“View”类是“widgets”类的基类,基本用来提供界面上的小对象,比如按钮之类的。"ViewGroup"类是"layouts"类的基类,是用来提供布局架构的。不知道对不对,还请各位斧正
接下来看最后一段:
A View object is a data structure whose properties store the layout parameters and content for a specific rectangular area of the screen. A View object handles its own measurement, layout, drawing, focus change, scrolling, and key/gesture interactions for the rectangular area of the screen in which it resides. As an object in the user interface, a View is also a point of interaction for the user and the receiver of the interaction events
我的理解是这样的:“View” 对象是一数据结构:其"properties(性质)"存储“布局”参数。“and content for a specific rectangular area of the screen”这紧接着的一句,我不知是何意。
"A View object handles its own measurement,layout,drawing,focus change, scrolling ...."
这句的意思是否是:"View"对象"handle"(掌管?这里的handle如何理解才合理?)着自己的很多性质“比如 layout,drawing,等等”,最后一句大概是说:View还是用户和事件交互的纽带。
还有一个问题:第二段明明说:"View Class"是负责界面上的小玩意的,比如按钮等等,而“ViewGroup Class”则是负责界面布局的。但第三段中说明了"View object"中的"property"存储了布局参数。这我就不理解了?那还用ViewGroup Class干嘛?
深深感觉小弟理解能力有问题,看Android 的 SDK ,很难理解。
看Android的书,更是不好理解....
这里,请大家帮我看看....谢谢啦