Android中的AndroidAnnotations

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 介绍到此,用到了再详细看他的文档。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值