The method Inflate() in android
Inflate() method can find out a layout defined by xml,as like the findViewById() method,but there have some different between them.
The different are:
If your Activity used other layout,such as the dialog layout,and you want to set the component's content in that layout.you must use the inflate() method to find it out,then use the findViewById() method to find other components above it.such as:
View view1=View.inflate(this,R.layout.dialog_layout,null);
TextViewdialogTV=(TextView)view1.findViewById(R.id.dialog_tv);
dialogTV.setText("abcd");
note:R.id.dialog_tv is in dialog layout,if you direct to use the this.findViewById(R.id.diaog_tv),it will throw error.
View viewStub = ((ViewStub) findViewById(R.id.stubView)).inflate();
you can imagine it as "hidden inflation",hide placed in view,before inflate() just to find the control,but no size and didn't occupy place in the view.
after inflate(),it must have size,but hide.
if you also interest in linux and android embed system,please connection with us in QQ grounp:139761394
The method Inflate() in android的更多相关文章
- [原创] Gradle DSL method not found: 'android()' 和 buildToolsVersion is not specified 的解决办法。
今天在用Android Studio 2.0 打开别人的较早版本生成的工程时, 提示: Gradle DSL method not found: 'android()'. 解决办法为,打开根目录下面的 ...
- Gradle DSL method not found: 'android()
原文错误提示: Error:(16, 0) Gradle DSL method not found: 'android()'Possible causes:<ul><li>Th ...
- 【转】解决Gradle DSL method not found: ‘android()’
[转]解决Gradle DSL method not found: ‘android()’ 最近导入as的项目出了这样的问题 这个问题困扰了我很长时间,好吧,搜了半天全都是runProguard的,最 ...
- android studio报错提示: Gradle DSL method not found: 'android() 解决方案
原文错误提示: Error:(16, 0) Gradle DSL method not found: 'Android()'Possible causes:<ul><li>Th ...
- java.lang.RuntimeException: Method setUp in android.test.ApplicationTestCase not mocked. See http://g.co/androidstudio/not-mocked for details.
解决: build.gradle里加入: android { testOptions { unitTests.returnDefaultValues = true } }
- 解决Gradle DSL method not found: ‘android()’
最近导入as的项目出了这样的问题 这个问题困扰了我很长时间,好吧,搜了半天全都是runProguard的,最后在stackoverflow上搜到解决办法了: http://stackoverflow. ...
- 【Android Studio】Gradle DSL method not found:'android()'
如图所示: 参考:http://www.jianshu.com/p/d370d41fb7da 又遇到了这个问题: 参考:http://stackoverflow.com/questions/24204 ...
- [Android]IllegalStateException: Could not find method onBind(View)
FATAL EXCEPTION: main Process: org.diql.aidldemo, PID: 2274 java.lang.IllegalStateException: Could n ...
- [Android ADB] An auto-input method for Android and Windows
The Valentine's Day is coming. Here is an auto-input method and you may use it to send multiple word ...
随机推荐
- JavaScript DOM编程艺术 读书笔记
2. JavaScript语法 2.1 注释 HTML允许使用"<!--"注释跨越多个行,但JavaScript要求这种注释的每行都必须在开头加上"< ...
- 亮相SIGGRAPH 太极拳三维教学App制作揭秘
http://news.hxsd.com/CG-animation/201208/663303.html 编者按:<My Tai Chi>是一系列基于移动平台的三维互动产品,由北京七星汇工 ...
- Kuangbin 带你飞 数位DP题解
以前一直不知道该咋搞这个比较好. 感觉推起来那个数字好麻烦.后来有一种比较好的写法就是直接的DFS写法.相应的ismax表示当前位是否有限制. 数位DP也是有一种类似模版的东西,不过需要好好理解.与其 ...
- SSH的简单入门体验(Struts2.1+Spring3.1+Hibernate4.1)- 查询系统(下)
我们继续吧,SSH最大的优点就是实现的系统的松耦合,能够将后台和前台有机的分离开来. 一.目录结构 一个好的程序要有一个好的开始.我们先来看看整个目录结构吧 主要的是三层架构概念,或者说是mvc的概念 ...
- DRF基类APIView提供的Request、Response和序列化器的综合使用
关于DRF基类APIView提供的Request和Response对象的作用,可以看我的另一篇博文:https://www.cnblogs.com/chichung/p/9939864.html 综合 ...
- delphi.memory.分配及释放---New/Dispose, GetMem/FreeMem及其它函数的区别与相同,内存分配函数
来自:http://www.cnblogs.com/qiusl/p/4028437.html?utm_source=tuicool&utm_medium=referral ---------- ...
- 前段基础JavaScript
JavaScript概述 JavaScript的历史 1992年Nombas开发出C-minus-minus(C--)的嵌入式脚本语言(最初绑定在CEnvi软件中).后将其改名ScriptEase.( ...
- (2)C# 创建ef oracle
1.NUGet下载 2.下载 Oracle Developer Tools for Visual Studio https://www.oracle.com/technetwork/develope ...
- dfs序学习总结
dfs序: 每个节点在dfs中的进出栈的时间序列. 树是非线性结构,根节点连着子节点,那么dfs序...节点进出栈的时间先后? 从根节点入栈,然后左儿子入栈,左儿子出栈,右儿子入栈,右儿子出栈,根节点 ...
- 线段树+差分【p1438】无聊的数列
Description 维护一个数列{a[i]},支持两种操作: 1.1 L R K D:给出一个长度等于R-L+1的等差数列,首项为K,公差为D,并将它对应加到a[L]~a[R]的每一个数上.即:令 ...