转 http://yxwang0615.iteye.com/blog/1711147一个Activity里如果直接用findViewById(),对应的是setConentView()的那个layout里的组件,因此如果你的Activity里如果用到别的layout,你就必须用inflate()先....
分类:
其他好文 时间:
2015-01-28 21:10:10
阅读次数:
227
很多人在网上问LayoutInflater类的用法,以及inflate()方法参数的含义,现解释如下:inflate()的作用就是将一个用xml定义的布局文件查找出来,注意与findViewById()的区别,inflate是加载一个布局文件,而findViewById则是从布局文件中查找一个控件。...
分类:
移动开发 时间:
2015-01-27 19:57:53
阅读次数:
120
1:全部布局自定义
LayoutInflater addBlackNumberInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View view = addBlackNumberInflater.inflate(R.layout.ale...
分类:
其他好文 时间:
2015-01-15 16:05:17
阅读次数:
165
1.listview入门,自定义的数据适配器 public class ListViewActivity extends Activity { private ListView lv; public String tag = "ListViewActivity"; @...
分类:
移动开发 时间:
2015-01-13 22:58:32
阅读次数:
243
package com.lidroid.xutils.sample;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import ...
分类:
其他好文 时间:
2015-01-13 12:38:15
阅读次数:
201
大家inflate应该用的比较多吧,尤其在使用listview 的时候。
先来看看item的布局文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="20...
分类:
其他好文 时间:
2015-01-10 01:28:38
阅读次数:
229
在开发项目中,想要使异步或分页加载更好看一些,可以在ListView加上HeaderView或者footerView。
1、生成一个FooterView
在例子中,只是实现了一个进度条,右侧一个提示文本,所以可以简单写一个布局,然后通过LayoutInflater生成一个View。
2、在ListView.setAdapter()方法之前调用ListVie...
分类:
其他好文 时间:
2015-01-09 17:22:27
阅读次数:
183
一、首先看带三个参数的inflate方法:
public View inflate (int resource, ViewGroup root, boolean attachToRoot)
1、如果root不为null,且attachToRoot为TRUE,则会在加载的布局文件的最外层再嵌套一层root布局,这时候xml根元素的布局参数当然会起作用。
2、如果root不为null,且atta...
分类:
移动开发 时间:
2015-01-09 15:35:37
阅读次数:
220
1,安卓系统源码:https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/view/LayoutInflater.java 这是是LayoutInflater的.....
分类:
移动开发 时间:
2015-01-08 17:10:07
阅读次数:
165