在使用ListView过程中我们有时候需要遍历取得每个Item项中的一些数据(比如每个Item里面有TextView,需要获取它的文本等等),但是我们在遍历过程中经常会遇到NullPointerException的异常,其实这不过是listview中getCount()和getChildCount(...
分类:
其他好文 时间:
2014-10-13 22:31:47
阅读次数:
286
通常我们更多的继承BaseAdapter来编写自己的Adapter类,因为BaseAdapter类是其他Adapter类的基类。在世界的运用过程中呢,我们一般需要重写这类的一些方法:
getCount() ;获取当前Adapter的Items数目
getItem(int position);获取相应Position(位置)的Item
getItemId(int position);获取相应p...
分类:
其他好文 时间:
2014-10-10 18:58:24
阅读次数:
168
for (var i = 0; i < storeEditFee.getCount(); i++) { json.push(storeEditFee.getAt(i).data);} json = Ext.util.JSON.encode(json);
分类:
Web程序 时间:
2014-10-09 20:52:17
阅读次数:
119
由于之前写Scroller应用:ListView滑动删除遇到Item视图错位问题,观察发现第1item位置改变后,第1+10的item布局也跟着改变,继续查看之所以间隔10,是因为我屏幕上显示10条数据,这个就涉及到getCount()和getChildCount()问题,进一步追踪发现应该是ListView视图缓存的问题,其实这个问题跟数据是一样的,不过我们在Adapter的getView中根据...
分类:
其他好文 时间:
2014-10-06 20:18:50
阅读次数:
184
private void bind() { AspNetPager1.RecordCount = getCount(); AspNetPager1.PageSize = 5; string sql = "select * from Books"; SqlDataA...
分类:
Web程序 时间:
2014-10-03 19:53:55
阅读次数:
262
很多初学者肯定会觉得,当播放到最后一个的时候,我只要再设为第一个不就好了吗?为什么要返回Integer.MAX_VALUE呢?注意getItem(int position)是怎么写的。那是自动轮播的情况,当你把轮播时间设长一点,在第一张图片,你无法手动向前滑动,同样的,在最后一张你也无法手动往后滑动...
分类:
其他好文 时间:
2014-09-30 11:05:11
阅读次数:
173
publicclassGetListViewHeight{ publicstaticvoidsetListViewHeightBasedOnChildren(ListViewlistView){ ListAdapterlistAdapter=listView.getAdapter(); if(listAdapter==null){ //pre-condition return; } inttotalHeight=0; for(inti=0;i<listAdapter.getCount();i++){ ..
分类:
其他好文 时间:
2014-09-01 15:49:14
阅读次数:
160
原文:http://blog.csdn.net/gaojinshan/article/details/18038181利用定时器,实现循环轮播,很简单;只需在定时器的消息里加如下代码即可:[java]view plaincopyintcount=adapter.getCount();if(count...
分类:
其他好文 时间:
2014-08-31 11:47:11
阅读次数:
294
BaseAdapter创建这么一个对象,需要些四个方法。 int getCount(); Object getItem(int position); long getItemId(int position);View getView(int position, View convertView, V...
分类:
移动开发 时间:
2014-08-19 23:59:05
阅读次数:
495
public class HomeAdapter extends BaseAdapter
{
public int getCount()
{
return names.length;
}
public View getView(int position, View convertView, ViewGroup parent)
{
View view = View.inflate...
分类:
其他好文 时间:
2014-08-11 18:06:42
阅读次数:
230