赞
踩
<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:bind=“http://robobinding.org/android”
xmlns:tools=“http://schemas.android.com/tools”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”
tools:context=“org.robobinding.androidmvvm.MainActivity”
tools:ignore=“MissingPrefix”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
bind:text=“{hello}”/> //单向绑定,修改Model属性时,会自动反映到视图中(需要实体中提供相应的getHello(),setHello()方法)。
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:orientation=“horizontal”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Name:”/>
<EditText
android:layout_width=“fill_parent”
android:layout_height=“wrap_content”
bind:text=“${name}”/> //双向绑定,修改model属性时,会自动反映到视图中;反过来,修改视图内容,也会自动更改Model的相关属性。
<Button
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Say Hello”
bind:onClick=“sayHello”/>
public class PresentationModel implements HasPresentationModelChangeSupport {
private PresentationModelChangeSupport changeSupport;
private String name;
public PresentationModel() {
changeSupport = new PresentationModelChangeSupport(this);
}
public String getHello() {
return name + “: hello Android MVVM(Presentation Model)!”;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name; Log.d(“model”, "setName(),name: " + name);
}
public void sayHello(){
changeSupport.firePropertyChange(“hello”);
}
@Override
public PresentationModelChangeSupport getPresentationModelChangeSupport() {
return changeSupport;
}
}
**Controller层: **
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PresentationModel presentationModel = new PresentationModel();
ViewBinder viewBinder = createViewBinder();
View rootView = viewBinder.inflateAndBind(R.layout.activity_main, presentationModel);//将model和view进行绑定
setContentView(rootView);
}
private ViewBinder createViewBinder() {
BinderFactory reusableBinderFactory = new BinderFactoryBuilder().build();
return reusableBinderFactory.createViewBinder(this);
}
}
----------------------------------------------Robobiding 简单使用结束:------------------------------------------------
android官方支持的databinding框架使用
使用条件:
android studio 1.3及以上版本
gradle 2.2及以上版本
android plugin for gradle 1.3.0及以上版本
使用步骤:
dependencies { classpath “com.android.databinding:dataBinder:1.0-rc1”}
apply plugin: ‘com.android.databinding’
注意
在项目编译过程中,会出现诸如以下错误:
错误一:
Error:Application and test application id cannot be the same: both are ‘com.fengjr.mobile’ for qihuDebugAndroidTest
此处要求test的application id和项目id不能一致,需将test 的id(即testApplicationId “com.fengjr.mobile"修改为"com.fengjr.mobile.test”)
示例
view 文件 activity_main.xml:
<?xml version="1.0" encoding="utf-8"?><variable
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip204888 (备注Android)
【Android 详细知识点思维脑图(技能树)】
其实Android开发的知识点就那么多,面试问来问去还是那么点东西。所以面试没有其他的诀窍,只看你对这些知识点准备的充分程度。so,出去面试时先看看自己复习到了哪个阶段就好。
虽然 Android 没有前几年火热了,已经过去了会四大组件就能找到高薪职位的时代了。这只能说明 Android 中级以下的岗位饱和了,现在高级工程师还是比较缺少的,很多高级职位给的薪资真的特别高(钱多也不一定能找到合适的),所以努力让自己成为高级工程师才是最重要的。
这里附上上述的面试题相关的几十套字节跳动,京东,小米,腾讯、头条、阿里、美团等公司19年的面试题。把技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节。
由于篇幅有限,这里以图片的形式给大家展示一小部分。
网上学习 Android的资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。希望这份系统化的技术体系对大家有一个方向参考。
一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!
AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算
一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!**](https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0)
AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。