【八】注入框架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 ...
随机推荐
- 创建第一个servlet程序--HelloServlet
这篇文章是用来纪念我第一次创建一个Servlet程序,步骤我会写得详细点,也可以参考一下,后续我会将SpringMVC 跟ssh的搭建分别更新(ps:不忙的话我会更新) 工具:java jdk 1.6 ...
- 转:典型开源3D引擎分类比较
常见的3D引擎有:Unreal.Quake.Lithtech.OGRE.Nebula.Irrlicht.Truevision3D... 其中开源免费的有:OGRE.irrlicht.fly3d.Neo ...
- JAVA微信扫码支付模式二功能实现完整例子
概述 本例子实现微信扫码支付模式二的支付功能,应用场景是,web网站微信扫码支付.实现从点击付费按钮.到弹出二维码.到用户用手机微信扫码支付.到手机上用户付费成功.web网页再自动调整到支付成功后的页 ...
- 多线程和Socket——在线聊天室
多线程开发和Socket技术 一.进程和线程 进程:每个应用程序对应一个进程: 线程:一个进程至少包含一个线程,线程要和CPU进行交互. 多线程并发(可以理解为):"同一时间"执行 ...
- CentOS下nodejs最简单的安装方法
1. 下载编译好的文件 我的系统是centos7,进入要存放下载资源的目录,个人建议存放在/usr/local/src/目录下.然后执行安装命令: wget http://nodejs.org/dis ...
- java实现https ssl请求url
import java.io.*;import java.net.*;import java.security.*;import java.security.cert.*;import java.ut ...
- Storage System and File System Courses
I researched a lot about storage system classes given at good universities this year. This had two r ...
- Java交替打印两个字符串
一.使用volatile关键字 public class Main { volatile int x = 0; Main() { new Thread(() -> { while (x < ...
- 【C++】atoi与stoi
stoi函数默认要求输入的参数字符串是符合int范围的[-2147483648, 2147483647],否则会runtime error.atoi函数则不做范围检查,若超过int范围,则显示-214 ...
- 转:Spring Cache抽象详解
缓存简介 缓存,我的理解是:让数据更接近于使用者:工作机制是:先从缓存中读取数据,如果没有再从慢速设备上读取实际数据(数据也会存入缓存):缓存什么:那些经常读取且不经常修改的数据/那些昂贵(CPU/I ...