一、LayoutInflater 的作用我们一般使用 LayoutInflater 做一件事:View inflate(int resource, ViewGroup root);inflate() 的作用类似于 findViewById(); 不同的是 findViewById 用于查找某一具体 ...
分类:
移动开发 时间:
2015-03-16 15:53:54
阅读次数:
150
昨天在qq群上有人问到类似QQ的聊天窗口抖动效果是怎么实现的,在这里我就简单的实现了一下,贴上代码:
final View decorView = ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);
Vibrator vibrator = (Vibrator) getSystemSe...
分类:
移动开发 时间:
2015-03-16 09:54:05
阅读次数:
237
转自:http://blog.sina.com.cn/s/blog_5e58565701012q2d.html错误:findViewById返回Null,报nullpointer错误网上搜了下,拾人牙慧,总结原因,一般为3种:1.在另一个view的元素应该用baseView.findViewById...
分类:
其他好文 时间:
2015-03-15 16:30:48
阅读次数:
139
Android LayoutInflater详解在实际开发中LayoutInflater这个类还是非常有用的,它的作用类 似于findViewById()。不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例化;而 findViewById()是找xml布局...
分类:
移动开发 时间:
2015-03-15 13:51:33
阅读次数:
127
原文: http://www.stormzhang.com/android/androidtips/2014/08/24/android-viewfinder/在Android获取一个View一般都是通过如下方式:TextView textView = (TextView) findViewById...
分类:
其他好文 时间:
2015-03-14 19:49:21
阅读次数:
113
摘自http://www.cnblogs.com/plokmju/p/android_handler.html注意:对于UI组件,不能再其他线程内操作它(如调用它的方法) 比如 Button bt1=(Button)findViewById(R.id.start); ...
分类:
移动开发 时间:
2015-03-14 00:58:24
阅读次数:
165
基于Http的通信packagecom.example.httpgetdemo;
publicclassMainActivityextendsActivity{
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button1)..
分类:
移动开发 时间:
2015-03-13 14:41:17
阅读次数:
159
button_14.setOnClickListener(newView.OnClickListener() {@OverridepublicvoidonClick(View v) {editText=(EditText)findViewById(R.id.editText);textContent...
分类:
移动开发 时间:
2015-03-13 00:16:06
阅读次数:
130
1、setContentView的作用是将View加载到根view之上,这样当显示view时,先显示根view,然后在显示子view,以此类推,最终将所有view显示出来。2、setContentView必须要放在findviewbyid之前,因为view在加载之前是无法引用的。3、setConte...
分类:
其他好文 时间:
2015-03-12 23:57:37
阅读次数:
142
实际上,官方已经提供了实现方法,但是,有很多捞偏门的教程,也有很优秀的第三方。写出来,供还没找到的同学参考。
前提是:你对android.support.v7.widget.Toolbar已经有过了解了。
mMainBar = (Toolbar)this.findViewById(R.id.main_bar);
this.setSupportActionBar(mMainBar);
m...
分类:
其他好文 时间:
2015-03-12 22:32:13
阅读次数:
229