Androidannotation的使用

1、錯誤:

The AndroidManifest.xml file contains the original component, and not the AndroidAnnotations generated component. Please register MyannoActivity_ instead of MyannoActivity

解決:在xml配置中activity設置

 <activity android:name=".Test_" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

2、添加jar(兩個jar,導入到不同的lids/com-libs)

3、activity的註解:

@EActivity(R.layout.test)
public class Test extends Activity {

    // 如果用註解,屬性訪問權限不能是private

    @ViewById
    EditText et;
    @ViewById
    TextView tv;

    @Click
    void btn() {
        tv.setText("你輸入了:" + et.getText());
    }

}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章