Android中的AndroidAnnotations
2015-12-17 14:31
393 查看
1、简介:是一个利用注解方式来简化代码结构,提高开发效率的开源框架,类似开源框架还有:roboguice 、butterknife 、dagger 等,该代码是一个第三方框架,通过注释来开发应用,使用Android Annotations能够大大减少代码量。
2、一些常用注释的使用方法:
@AfterInject 定义的方法在类的构造方法执行后执行
@AfterTextChange定义的方法在TextView及其子类的Text属性改变后执行
@AfterViews 定义的方法在setContentView后执行
@Background 定义的方法在后台线程执行
@BeforeTextChange 定义的方法在TextView及其子类的Text属性改变前执行
@Click 定义点击监听器
@EActivity 在Activity中启用Annotations
@EProvider 在 ContentProvider中启用Annotations
@EReceive 在BroadcastReceiver中启用Annotations
@EService 在Service中启用Annotations
@EView 在自定义的View的子类中启用Annotations
@Fullscreen 全屏
@NoTitle 无标题栏
3、eclipse的配置:http://jingyan.baidu.com/article/5552ef47c25fea518ffbc9e9.html
4、AvailableAnnotations
Enhanced components
@EActivity
@EApplication
@EBean
@EFragment
@EProvider
@EReceiver
@EIntentService
@EService
@EView
@EViewGroup
Injection
@AfterExtras
@AfterInject
@AfterViews
@App
@Bean
@Extra
@FragmentArg
@FragmentById
@FragmentByTag
@FromHtml
@HttpsClient
@NonConfigurationInstance
@RootContext
@SystemService
@ViewById
@ViewsById
Event binding
@TextChange
@AfterTextChange
@BeforeTextChange
@EditorAction
@FocusChange
@CheckedChange
@Touch
@Click
@LongClick
@ItemClick
@ItemLongClick
@ItemSelect
@OptionsItem
@SeekBarProgressChange
@SeekBarTouchStart
@SeekBarTouchStop
Threading
@Background
@UiThread
@SupposeBackground
@SupposeUiThread
Misc
@InstanceState
@WindowFeature
@Fullscreen
@NoTitle
@CustomTitle
@OptionsMenu
@OptionsMenuItem
@OrmLiteDao
@RoboGuice
@Trace
@Transactional
@OnActivityResult
@OnActivityResult.Extra
@HierarchyViewerSupport
@ServiceAction
@Receiver
@ReceiverAction
@ReceiverAction.Extra
@IgnoredWhenDetached
@WakeLock
Resource injection
@StringRes
@AnimationRes
@ColorRes
@DimensionPixelOffsetRes
@DimensionPixelSizeRes
@DimensionRes
@BooleanRes
@ColorStateListRes
@DrawableRes
@IntArrayRes
@IntegerRes
@LayoutRes
@MovieRes
@StringArrayRes
@TextArrayRes
@TextRes
@HtmlRes
Rest API
@Rest
@RestService
@Get
@Post
@Put
@Delete
@Options
@Head
@Accept
@RequiresHeader
@RequiresCookie
@RequiresCookieInUrl
@RequiresAuthentication
@SetsCookie
@RequiresCookieInUrl
Typesafe SharedPreferences
@DefaultBoolean
@DefaultFloat
@DefaultInt
@DefaultLong
@DefaultString
@DefaultStringSet
@DefaultRes
@Pref
@SharedPref 介绍到此,用到了再详细看他的文档。
2、一些常用注释的使用方法:
@AfterInject 定义的方法在类的构造方法执行后执行
@AfterTextChange定义的方法在TextView及其子类的Text属性改变后执行
@AfterViews 定义的方法在setContentView后执行
@Background 定义的方法在后台线程执行
@BeforeTextChange 定义的方法在TextView及其子类的Text属性改变前执行
@Click 定义点击监听器
@EActivity 在Activity中启用Annotations
@EProvider 在 ContentProvider中启用Annotations
@EReceive 在BroadcastReceiver中启用Annotations
@EService 在Service中启用Annotations
@EView 在自定义的View的子类中启用Annotations
@Fullscreen 全屏
@NoTitle 无标题栏
3、eclipse的配置:http://jingyan.baidu.com/article/5552ef47c25fea518ffbc9e9.html
4、AvailableAnnotations
Enhanced components
@EActivity
@EApplication
@EBean
@EFragment
@EProvider
@EReceiver
@EIntentService
@EService
@EView
@EViewGroup
Injection
@AfterExtras
@AfterInject
@AfterViews
@App
@Bean
@Extra
@FragmentArg
@FragmentById
@FragmentByTag
@FromHtml
@HttpsClient
@NonConfigurationInstance
@RootContext
@SystemService
@ViewById
@ViewsById
Event binding
@TextChange
@AfterTextChange
@BeforeTextChange
@EditorAction
@FocusChange
@CheckedChange
@Touch
@Click
@LongClick
@ItemClick
@ItemLongClick
@ItemSelect
@OptionsItem
@SeekBarProgressChange
@SeekBarTouchStart
@SeekBarTouchStop
Threading
@Background
@UiThread
@SupposeBackground
@SupposeUiThread
Misc
@InstanceState
@WindowFeature
@Fullscreen
@NoTitle
@CustomTitle
@OptionsMenu
@OptionsMenuItem
@OrmLiteDao
@RoboGuice
@Trace
@Transactional
@OnActivityResult
@OnActivityResult.Extra
@HierarchyViewerSupport
@ServiceAction
@Receiver
@ReceiverAction
@ReceiverAction.Extra
@IgnoredWhenDetached
@WakeLock
Resource injection
@StringRes
@AnimationRes
@ColorRes
@DimensionPixelOffsetRes
@DimensionPixelSizeRes
@DimensionRes
@BooleanRes
@ColorStateListRes
@DrawableRes
@IntArrayRes
@IntegerRes
@LayoutRes
@MovieRes
@StringArrayRes
@TextArrayRes
@TextRes
@HtmlRes
Rest API
@Rest
@RestService
@Get
@Post
@Put
@Delete
@Options
@Head
@Accept
@RequiresHeader
@RequiresCookie
@RequiresCookieInUrl
@RequiresAuthentication
@SetsCookie
@RequiresCookieInUrl
Typesafe SharedPreferences
@DefaultBoolean
@DefaultFloat
@DefaultInt
@DefaultLong
@DefaultString
@DefaultStringSet
@DefaultRes
@Pref
@SharedPref 介绍到此,用到了再详细看他的文档。
相关文章推荐
- Android优化指南
- Android Intent的花样启动
- android 布局2层叠加 能隔着上层点到下层的处理方法
- Android ImageView ScaleTypes介绍
- [干货]Android编程开发规范
- Android内存优化杂谈
- Android分区解释
- [干货]Android编程开发规范
- android开发的记录
- 【Android】Socket通讯示例(服务端/客户端)
- Android中Parcelable接口用法
- Android Activity 启动/退出 动画效果
- Android TextView(未完善)
- Android项目的结构
- Android中的windowSoftInputMode属性详解
- Android Studio 使用笔
- android 调用系统相机拍照 获取原图
- Android 可拖拽的GridView效果实现, 长按可拖拽和item实时交换位置
- 关于android性能,内存优化
- Android 上传图片到服务器