关闭

AndroidAnnotations——Enhance activities 优化Activities

标签: AndroidAnnotation
952人阅读 评论(0) 收藏 举报
分类:

Enhance activities


Since AndroidAnnotations 1.0

@EActivity


The @EActivity annotation indicates that an activity will be enhanced by AndroidAnnotations. Its value parameter must be a valid layout id, that will be used as the Content View for the activity.
为一个activity加了 @EActivity 注解后,则表示该activity被AndroidAnnotations加强了。它的参数值必须是一个合法layout id的,这个layout id被当作该activity的 Content View 使用。

You can leave the value parameter empty, which means that no content view will be set. You will probably want to set the content view yourself in the onCreate() method, before the binding is done.
你可以不写参数值,这意味着不设置content view。你也可能想要在绑定动作结束前,自己在onCreate() 方法中设置content view。

Usage example:

@EActivity(R.layout.main)
public class MyActivity extends Activity {

}
And without any layout id:
@EActivity
public class MyListActivity extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

}

Also see how to start an annotated activity.

本文档的简单示例下载

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:68339次
    • 积分:1208
    • 等级:
    • 排名:千里之外
    • 原创:17篇
    • 转载:7篇
    • 译文:33篇
    • 评论:16条
    最新评论