当前位置: 代码迷 >> 综合 >> AndroidAnnotations——Enhance activities 优化Activities
  详细解决方案

AndroidAnnotations——Enhance activities 优化Activities

热度:3   发布时间:2023-12-12 00:03:03.0

目录(?)[+]

  1. Enhance activities
    1. EActivity
  2. 本文档的简单示例下载

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 {
        @Overridepublic void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);setContentView(R.layout.main);}}

Also see how to start an annotated activity.

本文档的简单示例下载

  相关解决方案