Android 绑定 --- 简介

 

 

Introduction 

Android Binding is a new Open Source Framework for Android-Java providing xml layout view binding mechanism. It helsp development of Android Application by decoupling the View widgets and backend Activities. It is best work with MVP or MVVM patterns.

 

Android Binding 是一个为Android-Java提供xml布局视图绑定机制的开源框架。 它

 

 

Please also download from Market (Search "Markup Demo") the demo on most features of Android Binding.

你可以从Market(搜索“Markup Demo”)下载demo,这个demo使用了Android Bindding的大部分特性。

 

A more fundamental, getting started to Android MVVM with android-binding tutorial series is up in my own blog.

更基础的开始《Android MVVM 与android-binding 教程系列》已经上传至我的博客。

 

UPDATE: v0.2 is released. Please visit project homepage for details as it may not compatible with previous versions.

更新:v0.2已经发布。 更多细节请访问项目主页,它可能与以前的版本不兼容。

Critical Changes (as of 30/1/2010) 

重要变化(到30/1/2010)

 

If this is the first time you read this article, you may skip this section. 

如果这是你第一次看到这篇文章,你可以跳过这节

 

The version 0.11 of Android binding is released with this sample application. As the project evolves, a number of critical (yet would results breaking original codes) changes was made. Upon the release of 0.11 I suppose those changes should be final. 

Android binding 0.11版与这个示例application一同发布。随着项目的演变,发生了一些关键的改变(将导致破坏以前的代码)。而在0.11发布时是假设这些改变是最终的。

 

In the first time I wrote this article, Android Binding doesn't support binding to object collections, but now, it can bind to Cursor or Array, each 'row' of the records are treated as a View Model, which means Command and DependentObservables are all functional, which would be covered later in this article.  

在我第一次写这篇文章时,Android Binding 不支持绑定到集合对象,但是现在,它可以绑定到Cursor 或者Array, 记录的每一行被看作一个View Model,这意味着Command与DependentObservables 都是功能型的,它们将在本文的后面提及。

 

The sample application is rewritten, as the Contacts list no longer binds to the raw Adapter but via a more declarative way.  Action related binding renamed to have a 'on-' prefix, for example, click -> onClick to make it more distinctive. 

示例app已经被重写,因为联系列表不再绑定到原生Adapter上,而是而是通过一种更可描述性的方式。 与绑定有关的动作被重命名,添加了一个“on”前缀,例如, click->onClick 以使它更好区分。

 

Observable<T> now requires passing the class of T as parameter:  e.g. Observable<Boolean>(Boolean.class, true); 

现在Observable<T>需要传递class T作为参数,例如Observable<Boolean>

 

Since this makes writing such code too verbose, some shorthanded primitive observables are provided.  

因为这样使得编写这些代码过于繁琐, 提供了一些简短的observables

 

Sample Application

Following will briefly introduce how it is used. Where the sample application codes used here is obtainable at: 

http://code.google.com/p/android-binding/downloads/list 

and the compiled application is available at Android Market (Search "Android Binding" in Market).    

下面将简要介绍怎样使用它。 本例中使用的示例app源码可以在http://code.google.com/p/android-binding/downloads/list 获取。

编译过的app可以在Android Market (在Market里搜索“Android Binding”)下载。

 

This sample a modification based on Google's original Contact Manager Sample, the puropose of it is to show the different in view binding and the benefits of using Android Binding.

这个示例是在Google原先的Contact Manager示例的基础上修改而来, 目的是为了演示view 绑定区别以及使用Android Binding的好处。

Basic Configuration

To use Android Binding, all you need to do is to reference the library (in Eclipse, right click project -> Properties -> Android, reference the Android Binding Project as library). And then, in Application class:  

 Collapse
public class ContactManagerApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Binder.init(this
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值