【八】注入框架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 ...
随机推荐
- Java 基础【16】 文件(文件夹) 创建和删除
使用 java.io.file 创建文件(文件夹),算是 java 最基础的知识,但实战项目中还是需要知晓细节. 比如 File 类中的 mkdir() 和 mkdirs() 的区别. JDK API ...
- Webwork【07】文件上传下载
Web上传和下载应该是很普遍的一个需求,无论是小型网站还是大并发访问的交易网站.WebWork 当然也提供了很友好的拦截器来实现对文件的上传,让我们可以专注与业务逻辑的设计和实现,在实现上传和下载时顺 ...
- dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed解决办法
一个好友的国外VPS由于操作不当,结果装软件的时候总是提示dpkg: warning: files list file for package `*****' missing, assuming pa ...
- 〖Linux〗Ubuntu14.04安装32位运行库
在终端操作: sudo dpkg --add-architecture i386 echo "deb http://old-releases.ubuntu.com/ubuntu/ rarin ...
- linux mysql 数据库开启外部访问设置指南
Linux下设置MySQL和允许外部机器访问,具体目录是具体情况而定,有的人是安装了在个人目录下,则找到对应的目录则可以 Linux下设置MySQL和允许外部机器访问sudo vi /etc/my.c ...
- Linux常见命令缩写
缩写,是简介高效地表达 unix unix-like Linux 00.命令简写 ls:list(列出目录内容)cd:Change Directory(改变目录)su:switch user ...
- fedora开机出现There is a problem with the configuration server. (/usr/libexec/gconf-sanity-check-2 exited with status 256)
Install problem!The configuration defaults for GNOME Power Manager have not been installed correctly ...
- android开发学习---linux下开发环境的搭建&& android基础知识介绍
一.配置所需开发环境 1.基本环境配置 JDK 5或以上版本(仅有JRE不够) (http://www.oracle.com/technetwork/java/javase/downloads/ind ...
- linux shell 脚本攻略学习9--rename命令详解
rename命令详解: 对文件重命名是常用的操作之一,一般对单个文件的重命名用mv命令,如: amosli@amosli-pc:~/learn/example$ ls abc.txt amosli@a ...
- cobbler启动问题
[root@localhost ~]# cobblerTraceback (most recent call last): File "/usr/bin/cobbler", lin ...