LayoutInflater 详解
来源:互联网 发布:淘宝全屏大图代码 编辑:程序博客网 时间:2024/05/16 10:47
LayoutInflater 类用于初始化一个layout XML file into its corresponding View objects,他不能被直接实例化,只能通过getLayoutInflater()和getSystemService(String)两个方法实例一个标准的instance that is already hooked up to the current context and correctly configured for the device you are running on,
比如
LayoutInflater inflater = (LayoutInflater)context.getSystemService Context.LAYOUT_INFLATER_SERVICE);
To create a new LayoutInflater with an additional LayoutInflater.Factory
for your own views,
you can use cloneInContext(Context)
to clone an existing ViewFactory,
and then call setFactory(LayoutInflater.Factory)
on it to include your Factory.
构造方法
Protected Constructors LayoutInflater(Context context) Create a new LayoutInflater instance associated with a particular Context.LayoutInflater(LayoutInflater original, Context newContext) Create a new LayoutInflater instance that is a copy of an existing LayoutInflater, optionally with its Context changedPublic Methods abstract LayoutInflater cloneInContext(Context newContext) Create a copy of the existing LayoutInflater object, with the copy pointing to a different Context than the original.final View createView(String name, String prefix, AttributeSet attrs) Low-level function for instantiating a view by name.static LayoutInflater from(Context context) Obtains the LayoutInflater from the given context.Context getContext() Return the context we are running in, for access to resources, class loader, etc.final LayoutInflater.Factory getFactory() Return the current factory (or null).LayoutInflater.Filter getFilter() View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot) Inflate a new view hierarchy from the specified XML node.View inflate(int resource, ViewGroup root) Inflate a new view hierarchy from the specified xml resource.View inflate(int resource, ViewGroup root, boolean attachToRoot) Inflate a new view hierarchy from the specified xml resource.View inflate(XmlPullParser parser, ViewGroup root) Inflate a new view hierarchy from the specified xml node.void setFactory(LayoutInflater.Factory factory) Attach a custom Factory interface for creating views while using this LayoutInflater.void setFilter(LayoutInflater.Filter filter) Sets the LayoutInflater.Filter
to by this LayoutInflater.
- LayoutInflater 详解
- LayoutInflater详解
- LayoutInflater详解
- LayoutInflater详解
- LayoutInflater详解
- LayoutInflater详解
- LayoutInflater详解
- LayoutInflater详解
- layoutinflater详解
- LayoutInflater详解
- LayoutInflater 详解
- LayoutInflater详解
- layoutinflater详解
- LayoutInflater详解
- LayoutInflater 详解
- LayoutInflater详解
- Android LayoutInflater详解
- LayoutInflater inflate参数详解
- 设置NTFS磁盘文件夹的可写权限
- OpenFileDialog Filter InitialDirectory
- 用命令备份与还原网络设置
- C# 使用 Windows API 实例(QQ自动登陆的部分代码)
- Android提交Http请求时,显示对话框进度条并修改UI元素
- LayoutInflater 详解
- LINUX下/ect/rc.d/目录的作用 (redhat启动顺序)
- 获得客户端浏览器信息
- 在GAE上搭建个人博客
- 欢迎到我家做客
- C++ 小记
- [转载]GCC的__attribute__扩展功能
- linux下启动模式
- 第一次写的VC服务进程