【八】注入框架RoboGuice使用:(Your First Injected Fragment)
上一篇我们简单的介绍了一下RoboGuice的使用(【七】注入框架RoboGuice使用:(Your
First Custom Binding)),今天我们来看下fragment的注解
(一):简单介绍:和Activity一样,我们也相同能够在Fragment中使用注解,你须要一下的步骤.
①:编写一个继承与RoboFragment的Fragment;
②:设置你的布局(假设使用View注入)
③:注入你的View空间,资源文件(Resources),对象等等
(二):样例:
public class MyFragment extends RoboFragment {
// Inject your view
@InjectView(R.id.text1) TextView nameTextView;
// Inflate your view as you normally would for any fragment...
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.my_layout, container, false);
}
}
(三):兼容
如今RoboGuice 3.0版本号已经支持原生以及兼容Fragment,他们分别位于包名例如以下:
- package
roboguice.fragment(for support fragments) - package
roboguice.fragment.provided(for native android SDK 11+ fragments)
【八】注入框架RoboGuice使用:(Your First Injected Fragment)的更多相关文章
- 【九】注入框架RoboGuice使用:(Your First Injected Service and BroadcastReceiver)
上一篇我们简单的介绍了一下RoboGuice的使用([八]注入框架RoboGuice使用:(Your First Injected Fragment)),今天我们来看下服务(Service)和广播接受 ...
- 【十二】注入框架RoboGuice使用:(Your First Injected ContentProvider)
上一篇我们简单的介绍了一下RoboGuice的使用([十一]注入框架RoboGuice使用:(Your First Injection into a Custom View class)),今天我们来 ...
- 【十】注入框架RoboGuice使用:(Your First Testcase)
上一篇我们简单的介绍了一下RoboGuice的使用([九]注入框架RoboGuice使用:(Your First Injected Service and BroadcastReceiver)),今天 ...
- 【十三】注入框架RoboGuice采用:(Logging via Ln)
上一篇我们简单的介绍了一下RoboGuice的使用([十二]注入框架RoboGuice使用:(Your First Injected ContentProvider)),今天我们来看下Log日志使用. ...
- 【四】注入框架RoboGuice使用:(Your First System Service Injection)
上一篇我们简单的介绍了一下RoboGuice的使用([三]注入框架RoboGuice使用:(Your First Resource Injection)),今天我们来看下系统服务的使用注解的方法: 为 ...
- 【十一年】注入框架RoboGuice采用:(Your First Injection into a Custom View class)
上一篇我们简单的介绍了一下RoboGuice的使用([十]注入框架RoboGuice使用:(Your First Testcase)),今天我们来看下自己定义View的注入(Custom View). ...
- 【七】注入框架RoboGuice使用:(Your First Custom Binding)
上一篇我们简单的介绍了一下RoboGuice的使用([六]注入框架RoboGuice使用:(Singletons And ContextSingletons)),今天我们来看下自己定义绑定(bindi ...
- 【三】注入框架RoboGuice使用:(Your First Resource Injection)
上一篇我们简单的介绍了一下RoboGuice的使用([二]注入框架RoboGuice使用:(Your First View Injection)),今天我们来看下资源文件的使用注解的方法: 为了在Ac ...
- 【六】注入框架RoboGuice使用:(Singletons And ContextSingletons)
上一篇我们简单的介绍了一下RoboGuice的使用([五]注入框架RoboGuice使用:(Your First POJO Injection)),今天我们来看下单例以及上下文单例(ContextSi ...
随机推荐
- XMLHttpRequest HTTP请求的返回码为0 http status = 0
由于用户在http返回前关闭/取消,或者防火墙等原因,会造成http请求没有status信息.w3c有相应的说明:http://www.w3.org/TR/XMLHttpRequest/#the-st ...
- 测试json字符和java对象属性不一样在多个json框架下转换的表现
package com.longge.mytest; import java.io.IOException; import org.junit.Test; import com.alibaba.fas ...
- Ajax学习(一)
ajax是什么? Asynchronous Javascript And XML:异步的js和xml 他能使得js访问服务器,而且是异步的. 服务器给客户端的响应一般是整个页面,一个完整的html页面 ...
- LevelDB和ForestDB简单性能测试(含代码)
测试环境简单说明 Windows下测试 硬件环境如下: 处理器:Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz 内 存:8GB 硬 盘:希捷 ST1000DM003 操 ...
- 有关python numpy pandas scipy 等 能在YARN集群上 运行PySpark
有关这个问题,似乎这个在某些时候,用python写好,且spark没有响应的算法支持, 能否能在YARN集群上 运行PySpark方式, 将python分析程序提交上去? Spark Applicat ...
- Inno Setup入门(十)——操作注册表
有些程序需要随系统启动,或者需要建立某些文件关联等问题,这些都是通过在安装程序中对注册表进行操作的结果.Inno Setup中通过[registry]段实现对注册表的操作. 本段说明: 参数列表: 参 ...
- 在Java中使用Kafka
Producer部分 Producer在实例化后, 对外提供send方法, 用于将数据送到指定的topic和partition; 以及在退出时需要的destroy方法. 接口 KafkaProduce ...
- js截取相应的域名----正则匹配法 和校验Url 正则表达式
js截取相应的域名----正则匹配法 和校验Url 正则表达式 用javascript截取相应的域名方法两种,供大家参考 1.方法1: [javascript] view plain copy fun ...
- (原+译)pytorch中保存和载入模型
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/8108466.html 参考网址: http://pytorch.org/docs/master/not ...
- svn备份与还原_脚本_(dump命令)
今天备份svn, 能保证好用就行先, 回头再研究 buerguo.bat @echo off :: 关闭回显 :: 说明:如有命令不明白,请使用帮助命令:命令/? .如:for/? :: 设置标题 t ...