baseAdapt getView 重复执行很对遍原因
2015-05-07 18:05
148 查看
<p> </p><p> mViewSwitcher = (ViewSwitcher)v.findViewById(R.id.switcher); mViewSwitcher.setFactory(this); mViewSwitcher.getCurrentView().requestFocus(); </p>
@Override public View makeView() { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); mScrollerViewGroup = (InterceptEventCommonViewGroup) inflater.inflate(R.layout.doov_full_mont_by_week_list_view,null, false); mScrollerViewGroup.setOnGestureListener(mMonthGestureDetector); mScrollerViewGroup.setOnScrollerStatusListenner(this); return mScrollerViewGroup; }
ViewSwitch 中添加listView,
设定:
android:layout_width="match_parent"
android:layout_height="match_parent"
镶嵌到 RelativeLayout中 即可解决getView执行多次问题:
doov_full_mont_by_week_list_view.xml
<?xml version="1.0" encoding="UTF-8"?> <com.doov.calendar.view.InterceptEventCommonViewGroup xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/month_scroller" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/month_current_list" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="@null" android:fadeScrollbars="false" android:fadingEdge="none" android:drawSelectorOnTop="true" /> </RelativeLayout> </com.doov.calendar.view.InterceptEventCommonViewGroup>
这样 baseAdapter 中getView的执行次数应该是 getCount();即 listView 的行数。
相关文章推荐
- Android中ListView的适配器中getView()被重复调用的原因及解决方案.
- android getView方法不执行的一个原因是布局文件中没有给列表显示的位置
- [Android] ListView中getView的原理+如何在ListView中放置多个item + android中ListView多次刷新多次重复执行getView的问题另解
- 自定义adapter 的getView方法被重复执行了n次的解决方法
- 重写ListView的Adapter时,getView()方法没有执行的原因
- android-继承BaseAdapter--自定义适配器,getView执行多次的解决方法
- 源码分析 Laravel 重复执行同一个队列任务的原因
- android中ListView多次刷新多次重复执行getView的问题另解
- baseadapter getview 重复刷新 ViewPager -- Fragment 切换卡顿 LazyLoad
- 关于Action重复执行两遍的原因
- android: BaseAdapter的getview方法会多次重复调用
- 解决getView方法重复执行的问题
- 关于Action重复执行两遍的原因
- android中ListView多次重复执行getView的问题
- spring batch无法重复执行的原因和解决办法
- 【android学习笔记】自定义Adapter继承BaseAdapter获取不到getview或者getview不执行的问题
- android getView方法不执行的一个原因是布局文件中没有给列表显示的位置
- android中ListView多次刷新重复执行getView的解决方法
- 关于ListView中继承BaseAdapter重写getview的显示重复数据或报转换错误的问题
- 自定义adapter 的getView方法被重复执行了n次的解决方法