懒人必备之Android效率开发框架(伪原创)
2015-08-29 19:14
465 查看
在网上看到一个好的框架,记录一下,防止以后忘记了
这个框架貌似给我减少了很多不必要的代码,不过好像其中也有些不能满足的,以后靠自己去补充吧
我使用的是intellij idea ,配置android studio 情况是一样的
第一要下载两个包
一个是:androidannotations-3.2.jar
还有是:androidannotations-api-3.2.jar
下载地址:http://androidannotations.org/
配置
把androidannotations-api-3.2.jar引用进去工程
在setting 中找Comiler -> Annotations Processor ,选择Enable annotation processing ,在Processor path 找到现有的androidannotations-3.2.jar文件
Store generated sources relative to 有两个选择,我们选择Module content root
在Activity中类上面加上@EActivity (R.layout.xxx),去掉onCreate 中的setContent 如:
在AndroidMainfest.xml 注册的activity 名字需要变为
类名后面加下划线
编译一下 在Module 的Sources 多出一个generated ,这个时候需要把这个引用到工程里面去,类似src和gen 一样
到现在一起ok
这个框架貌似给我减少了很多不必要的代码,不过好像其中也有些不能满足的,以后靠自己去补充吧
我使用的是intellij idea ,配置android studio 情况是一样的
第一要下载两个包
一个是:androidannotations-3.2.jar
还有是:androidannotations-api-3.2.jar
下载地址:http://androidannotations.org/
配置
把androidannotations-api-3.2.jar引用进去工程
在setting 中找Comiler -> Annotations Processor ,选择Enable annotation processing ,在Processor path 找到现有的androidannotations-3.2.jar文件
Store generated sources relative to 有两个选择,我们选择Module content root
在Activity中类上面加上@EActivity (R.layout.xxx),去掉onCreate 中的setContent 如:
@EActivity (R.layout.main) public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main); } }
在AndroidMainfest.xml 注册的activity 名字需要变为
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="MyActivity_" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application>
类名后面加下划线
编译一下 在Module 的Sources 多出一个generated ,这个时候需要把这个引用到工程里面去,类似src和gen 一样
到现在一起ok
相关文章推荐
- DrawerLayout、CoordinatorLayout、CollapsingToolbarLayout的使用--AndroidSupportDesign练手
- Android-补间动画基本使用(位移、缩放、旋转、透明)
- 有关findviewbyid 一个错误用法
- Android 如何制作九宫格图片(.9.png)
- android如何保证service不被杀死
- Android将应用程序的崩溃信息如何保存到本地文件,并上传服务器
- Android将应用程序的崩溃信息如何保存到本地文件,并上传服务器
- Android UDP通信的成败判断
- android FragmentTabHost 的简单使用
- Android消息循环机制
- Android 自定义弹窗 Dialog
- listview实现跑马灯效果,和焦点获取
- 关于讯飞 使用android SDK出现21001错误码的分析
- Android屏幕适配全攻略(最权威的官方适配指导)
- android-ImageView的拖动、旋转、缩放、边界回弹、双击缩放、单击销毁及源码下载
- Android搜索框效果
- Android自定义View绘制闹钟
- mac 下android studio 下载sdk
- 我的第一篇csdn博客 -- 自定义View
- Windows风格的Loading动画Android实现(3)