Android是否支持MVC(模型视图控制器)结构?

前端之家收集整理的这篇文章主要介绍了Android是否支持MVC(模型视图控制器)结构?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道,如果 Android支持MVC(模型视图控制器)结构?如果有支持的话
1.什么是控制器?
2.什么是模特?和
3.什么是观点?

请清楚我.我对此有些困惑.

解决方法

Which design patterns are used on Android?

Model-View-Control works fine

The actual Activity class doesn’t extend android’s View class,but it
does,however,handle displaying a window to the user and also handle
the events of that window (onCreate,onPause etc).

This means,that when you are using a MVC pattern,your controller
will actually be a pseudo View-Controller. Since it is handling
displaying a window to the user,with the additional view components
you have added to it with setContentView,and also handling events for
atleast the varIoUs activity life cycle events.

In MVC,the controller is supposed to be the main entry point. Which
is a bit debatable if this is the case when applying it to android
development,since the activity is the natural entry point of most
applications.

那么,Android中的伪MVC:

Model =具有主要业务逻辑的实体或类

View =布局,资源和小部件,如EditText

Controller = Activity,Adapter

猜你在找的Android相关文章