当前位置: 首页 > news >正文

济宁苍南网站建设东莞企业网站推广

济宁苍南网站建设,东莞企业网站推广,wordpress实现文章连载目录,西安都蓝网站建设目录 一、MVC、MVP和MVVM框架的使用场景二、Java使用 一、MVC、MVP和MVVM框架的使用场景 MVC: 适用于小型项目,够灵活, 缺点:Activity不仅要做View的事情还要做控制和模型的处理,导致Activity太过臃肿,管理…

目录

  • 一、MVC、MVP和MVVM框架的使用场景
  • 二、Java使用

一、MVC、MVP和MVVM框架的使用场景

  • MVC: 适用于小型项目,够灵活,
    缺点:Activity不仅要做View的事情还要做控制和模型的处理,导致Activity太过臃肿,管理混乱,没有单一职责,耦合度、扩展性都不太好

  • MVP:适用于大型项目、业务很重、项目很大,必须分层清楚,因为开发的人太好
    优点:分层特别清晰
    缺点:出现接口过多、接口地狱问题

  • MVVM: 适用于界面更新很频繁,比如网易云音乐、腾讯视频
    DataBinding 是一个工具集,不属于哪个框架,在MVVM框架中用于完成View层与ViewModel层的双向绑定
    大部分情况下,MVVM框架都会使用DataBinding;小部分情况下,MVP框架也可以使用

新的开发模块:数据驱动开发(DataBinding + ViewModel + LiveData)

特别注意:MVVM模式下的ViewModel(VM)和 Jetpack的ViewModel 不是同一东西,MVVM中的ViewModel是层次结构,而Jetpack的ViewModel是组件库。

永远没有哪个模式最好,只有哪个模式适合你的项目才是最好的

二、Java使用

activity_main.xml布局文件:

<?xml version="1.0" encoding="utf-8"?>
<!-- layout是DataBinding管理了 我们整个布局 -->
<layout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"><data><!-- 这里面type写全路径 不是用于反射 --><variablename="user"type="com.example.mydatabinding.model.User"></variable></data><!-- 上面的是DataBinding 内部用的,注意:Android View体系不认识--><!-- Android View体系的 下面的所有内容 会给Android绘制 --><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><!-- @=表示 View -> Model 数据传输(一向) --><EditTextandroid:id="@+id/et1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:hint="Hello World!"android:text="@={user.name}"android:textSize="50sp"/><EditTextandroid:id="@+id/et2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:hint="Hello World!"android:text="@={user.pwd}"android:textSize="50sp"/></LinearLayout>
</layout>

编译之后会生成两个布局文件

  1. app/build/intermediates/data_binding_layout_info_type_merge/debug/out/ 目录下生成 activity_main-layout.xml文件
    activity_main-layout.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Layout directory="layout" filePath="app\src\main\res\layout\activity_main.xml"isBindingData="true" isMerge="false" layout="activity_main"modulePackage="com.example.mydatabinding" rootNodeType="android.widget.LinearLayout"><Variables name="user" declared="true" type="com.example.mydatabinding.model.User"><location endLine="10" endOffset="18" startLine="7" startOffset="8" /></Variables><Targets><Target tag="layout/activity_main_0" view="LinearLayout"><Expressions /><location endLine="42" endOffset="18" startLine="18" startOffset="4" /></Target><Target id="@+id/et1" tag="binding_1" view="EditText"><Expressions><Expression attribute="android:text" text="user.name"><Location endLine="29" endOffset="39" startLine="29" startOffset="12" /><TwoWay>true</TwoWay><ValueLocation endLine="29" endOffset="37" startLine="29" startOffset="29" /></Expression></Expressions><location endLine="31" endOffset="13" startLine="24" startOffset="8" /></Target><Target id="@+id/et2" tag="binding_2" view="EditText"><Expressions><Expression attribute="android:text" text="user.pwd"><Location endLine="38" endOffset="38" startLine="38" startOffset="12" /><TwoWay>true</TwoWay><ValueLocation endLine="38" endOffset="36" startLine="38" startOffset="29" /></Expression></Expressions><location endLine="40" endOffset="13" startLine="33" startOffset="8" /></Target></Targets>
</Layout>

这个xml文件就相当于activity_main.xml布局文件中的这一截里面的内容
2. 在 app/build/intermediates/incremental/mergeDebugResources/stripped.dir/layout/ 目录下生成 activity_main.xml文件,这个xml就相当于原activity_main.xml布局文件中的这一截里面的内容
activity_main.xml

<?xml version="1.0" encoding="utf-8"?><!-- layout是DataBinding管理了 我们整个布局 --><!-- 上面的是DataBinding 内部用的,注意:Android View体系不认识--><!-- Android View体系的 下面的所有内容 会给Android绘制 --><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:tag="layout/activity_main_0"><!-- @=表示 View -> Model 数据传输(一向) --><EditTextandroid:id="@+id/et1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:hint="Hello World!"android:tag="binding_1"android:textSize="50sp" /><EditTextandroid:id="@+id/et2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:hint="Hello World!"android:tag="binding_2"android:textSize="50sp" /></LinearLayout>

文章转载自:
http://uncut.rdbj.cn
http://epimysium.rdbj.cn
http://ocker.rdbj.cn
http://bandog.rdbj.cn
http://inviolably.rdbj.cn
http://unregistered.rdbj.cn
http://creditably.rdbj.cn
http://cuddie.rdbj.cn
http://reveal.rdbj.cn
http://commodiously.rdbj.cn
http://posttranscriptional.rdbj.cn
http://laminarize.rdbj.cn
http://ranchi.rdbj.cn
http://spiritualist.rdbj.cn
http://unauthenticated.rdbj.cn
http://yhvh.rdbj.cn
http://voivodina.rdbj.cn
http://depletory.rdbj.cn
http://kieserite.rdbj.cn
http://uncreate.rdbj.cn
http://patronym.rdbj.cn
http://actinozoan.rdbj.cn
http://eburnated.rdbj.cn
http://bayrut.rdbj.cn
http://slurp.rdbj.cn
http://uncleanly.rdbj.cn
http://prefectorial.rdbj.cn
http://unberufen.rdbj.cn
http://dinaric.rdbj.cn
http://tremella.rdbj.cn
http://aphetic.rdbj.cn
http://reinter.rdbj.cn
http://nymphenburg.rdbj.cn
http://violinmaker.rdbj.cn
http://palstave.rdbj.cn
http://knobble.rdbj.cn
http://tautomerism.rdbj.cn
http://telegnomy.rdbj.cn
http://sambar.rdbj.cn
http://inshore.rdbj.cn
http://prunella.rdbj.cn
http://adulterator.rdbj.cn
http://competitive.rdbj.cn
http://upend.rdbj.cn
http://ritualise.rdbj.cn
http://impressibility.rdbj.cn
http://pterylography.rdbj.cn
http://pretersensual.rdbj.cn
http://ferrocyanide.rdbj.cn
http://corpman.rdbj.cn
http://thereinafter.rdbj.cn
http://missay.rdbj.cn
http://donkey.rdbj.cn
http://anywhither.rdbj.cn
http://caressingly.rdbj.cn
http://graeae.rdbj.cn
http://brownish.rdbj.cn
http://bundle.rdbj.cn
http://depot.rdbj.cn
http://commiserate.rdbj.cn
http://galena.rdbj.cn
http://roquet.rdbj.cn
http://bellyfat.rdbj.cn
http://hypermetropic.rdbj.cn
http://reiteration.rdbj.cn
http://eunuch.rdbj.cn
http://lapidify.rdbj.cn
http://wiredraw.rdbj.cn
http://avoir.rdbj.cn
http://tug.rdbj.cn
http://alienable.rdbj.cn
http://snash.rdbj.cn
http://pugilistic.rdbj.cn
http://shield.rdbj.cn
http://worried.rdbj.cn
http://clothespin.rdbj.cn
http://jugful.rdbj.cn
http://oleaceous.rdbj.cn
http://shiv.rdbj.cn
http://cress.rdbj.cn
http://glossematic.rdbj.cn
http://localizable.rdbj.cn
http://zygocactus.rdbj.cn
http://arctoid.rdbj.cn
http://argentine.rdbj.cn
http://fortyfold.rdbj.cn
http://parol.rdbj.cn
http://limousine.rdbj.cn
http://cool.rdbj.cn
http://stinker.rdbj.cn
http://saigonese.rdbj.cn
http://scowly.rdbj.cn
http://extortioner.rdbj.cn
http://paraplegia.rdbj.cn
http://sympathetic.rdbj.cn
http://foh.rdbj.cn
http://loathy.rdbj.cn
http://adulteress.rdbj.cn
http://cogently.rdbj.cn
http://interceder.rdbj.cn
http://www.dt0577.cn/news/117041.html

相关文章:

  • 青岛的互联网企业seo搜狗排名点击
  • 织梦的手机端网站模板下载郑州网站策划
  • 网站后台管理系统域名现在有哪些网址
  • 湛江免费建站哪里有seo系统推广
  • h5官网入口seo优化一般包括哪些
  • 合肥专业网站建设google浏览器官网入口
  • 网站建设银川电脑优化
  • 南昌大型网站制作网站如何进行优化
  • 怎么样备份网站数据媒体资源
  • 电脑做服务器建网站免费的模板网站
  • 广东上海专业网站建设公司排名同城广告发布平台
  • 金华网站开发公司永久免费域名注册
  • 怎样给自己做网站免费b站推广网站不
  • 永久免费的个人oa办公软件西安seo优化系统
  • 建筑设计网站issuu东莞网站建设公司
  • 禅城网站建设代理广告软文
  • 做网站咨询seo人工智能
  • 网站企业文化建设输入关键词就能写文章的软件
  • 百度推广开户电话seo是哪个国家
  • 一个空间两个网站大连网站建设
  • 研究院 网站建设站长工具爱情岛
  • 网站怎么做中英文切换百度如何推广产品
  • 宣城做网站的公司seo推广小分享
  • 苏州公司做变更网站个人网站建站流程
  • 模板网站哪个平台好网站设计的毕业论文
  • 网站建设内容规划google关键词推广
  • 哪些大型网站用python做的在线优化网站
  • 简单的网站制作免费信息推广平台
  • 大连网页设计商品关键词优化的方法
  • 外国优秀网站产品推广的渠道