public View getView(int position, View convertView, final ViewGroup parent)三个参数的意思
最近看到有人在问这三个参数的含义,其实帮助已经很详细的介绍了这三个参数,看来还是要好好学学英语了,不然连解释都看不懂。
/**
* Get a View that displays the data at the specified position in the data set. You can either
* create a View manually or inflate it from an XML layout file. When the View is inflated, the
* parent View (GridView, ListView...) will apply default layout parameters unless you use
* {@link android.view.LayoutInflater#inflate(int, android.view.ViewGroup, boolean)}
* to specify a root view and to prevent attachment to the root.
*
* @param position The position of the item within the adapter's data set of the item whose view
* we want.
* @param convertView The old view to reuse, if possible. Note: You should check that this view
* is non-null and of an appropriate type before using. If it is not possible to convert
* this view to display the correct data, this method can create a new view.
* @param parent The parent that this view will eventually be attached to
* @return A View corresponding to the data at the specified position.
*/
public View getView(int position, View convertView, final ViewGroup parent)三个参数的意思的更多相关文章
- 在getview方法中有三个参数,起到优化的部分为ViewHolder的使用,主要方法setTag(),getTag()
适配器代码如下: public class Myadapter extends BaseAdapter { List<String> date; Context context; //构造 ...
- 【Android - 自定义View】之自定义View浅析
1.概述 Android自定义View / ViewGroup的步骤大致如下: 1) 自定义属性: 2) 选择和设置构造方法: 3) 重写onMeasure()方法: 4) 重写onDraw()方法: ...
- public void onItemClick(AdapterView arg0, View view, int position,long arg3)详解【整理自网络】
参考自: http://blog.csdn.net/zwq1457/article/details/8282717 http://blog.iamzsx.me/show.html?id=147001 ...
- ListView onItemClick(AdapterView<?> parent, View view, int position, long id)参数详解
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { parent.getA ...
- onItemClick(AdapterView<?> parent, View view, int position, long id)
Public Methods public abstract void onItemClick (AdapterView<?> parent, View view, int positio ...
- Android View.setId(int id) 用法
Android View.setId(int id) 用法 当要在代码中动态的添加View并且为其设置id时,如果直接用一个int值时,Studio会警告. 经过查询,动态设置id的方法有两种; 1. ...
- AdapterView<?> arg0, View arg1, int arg2, long arg3參数含义
arg0:是指父Vjew arg1就是你点击的那个Item的View arg2是position,position是你适配器里面的position arg3是id,通常是第几个项.id是哪个项View ...
- Android中自定义样式与View的构造函数中的第三个参数defStyle的意义
零.序 一.自定义Style 二.在XML中为属性声明属性值 1. 在layout中定义属性 2. 设置Style 3. 通过Theme指定 三.在运行时获取属性值 1. View的第三个构造函数的第 ...
- 获取View的截图-将View转换为Bitmap对象
开发中,有时候需要获取View的截图来做动画来达到动画流程的目的 原理:将View的内容画到一个Bitmap画布上,然后取出 下面封装了一个从View生成Bitmap的工具类 /** * 将View转 ...
随机推荐
- 简单的Datatable转List,Json
这里用到了Newtonsoft.Json,下载地址:http://json.codeplex.com/ 1.根据不同的Model转为对应的List public static List<Mode ...
- MySQL显示连接的数据库名
在默认下,MySQL在use databasename的时候,是不显示连接的库名! mysql> show databases;+--------------------+| Database ...
- MVC学习系列——HtmlHelper扩展
微软自带很多HtmlHelper: ActionLink - 链接到操作方法.BeginForm - 标记窗体的开头并链接到呈现该窗体的操作方法.CheckBox - 呈现复选框.DropDown ...
- Linux Shell编程变量赋值和引用
我们可以使用任意一种文字编辑器,比如gedit.kedit.emacs.vi等来编写shell脚本,它必须以如下行开始(必须放在文件的第一行): #!/bin/sh ... 注意:最好使用“! ...
- Fragment inner class should be static
package com.example.fragmenttest; import android.annotation.SuppressLint; import android.app.Activit ...
- Java 8 VM GC Tuning Guide Charter3-4
第三章 Generations One strength of the Java SE platform is that it shields the developer from the compl ...
- switch..case函数的基础使用一
基本作用:switch中的参数与case的值进行比对,相等则进入case. JDK1.7 switch支持int.Integer.String类型 package com.my.test; impor ...
- js函数:setInterval()/clearInterval()——js网页计时器
一.setInterval()/clearInterval()技术学习 都是window对象的方法,可以直接使用. setInterval(function(){},1000);:每1000毫秒执行一 ...
- [CFgym]2015-2016 ACM-ICPC Pacific Northwest Regional Contest小结
*感谢两位浙江大佬带我飞 贴下成绩 div2 div1 *div2不是我打的上个厕所就5/11了 比赛小结 A [题目大意] 有n(n<=500)个机场,两两之间距离是g[i][j],每经停一个 ...
- $POST数组论证($GET || $COOKIE || $REQUEST 同理)
我觉得还是有多个$_POST 如果只有一个$_POST,那么,多个人[同时]提交的话就不好处理 或者一个$_POST 时间限制(如同时钟周期)处理(不可能,不然响应没这么快) 或者 一个$_POS ...