2012年4月19日

android中LayoutInflater的使用

摘要: Inflater英文意思是膨胀,在Android中应该是扩展的意思吧。LayoutInflater的作用类似于 findViewById(),不同点是LayoutInflater是用来找layout文件夹下的xml布局文件,并且实例化!而 findViewById()是找具体某一个xml下的具体 widget控件(如:Button,TextView等)。(0)她可以有很多地方可以使用,如BaseAdapter的getView中,自定义Dialog中取得view中的组件widget等等。它的用法有2种:复制到剪贴板Java代码viewplaincopytoclipboardprint? Layo 阅读全文

posted @ 2012-04-19 22:59 明明的天天 阅读(339) 评论(0) 推荐(0)

View.setTag()的作用

摘要: 这个东西在一些需要用到Adapter自定控件显示方式的时候非常有用Adapter 有个getView方法,可以使用setTag把查找的view缓存起来方便多次重用public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vh; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) mWidgetsSwitchApp .getSystemService(Context.LAYOUT_INFLATER_SE 阅读全文

posted @ 2012-04-19 22:44 明明的天天 阅读(330) 评论(0) 推荐(0)

导航