当前位置: 首页 > news >正文

宣传册设计及网站建设软文广告300字范文

宣传册设计及网站建设,软文广告300字范文,wordpress政府模板cms,wordpress分词一、问题原因 昨天,突然一个问题丢在了我的头上,用户反馈说某某界面下拉刷新不好使啊,怎么回事。二话不说直接运行项目,经过测试,发现果然不好使。一看代码提交日期好家伙2020年,百思不得其解,…

一、问题原因

昨天,突然一个问题丢在了我的头上,用户反馈说某某界面下拉刷新不好使啊,怎么回事。二话不说直接运行项目,经过测试,发现果然不好使。一看代码提交日期好家伙2020年,百思不得其解,为啥20年的下拉刷新不好使,到现在才反馈。

还是看问题原因吧。
看了下下拉刷新框架是PullToRefreshView(好像没有用过这个框架),经过测试发现下拉手势怎么都不能回调到刷新回调,
只能断点调试了。
有几个方向可以试探下。

  • ViewPager拦截我们的触摸事件了,导致触摸事件没有下发到我们的listView中
  • 没有正确注册刷新回调接口
  • ListView本身没有处理好下拉事件

以上都是几个猜想方向,我们一一验证。
我们就直接注册ListView触摸事件回调,就可以验证上述猜想。经过验证发现,以上猜想都错了。那么问题是出在哪呢。
跟着代码一步一步走下去就能发现原因了。

二、问题分析

经过调试,最终定位到PullToRefreshBase这个类中。在这个类的onInterceptTouchEvent方法中找到了处理手势的逻辑。

public final boolean onInterceptTouchEvent(MotionEvent event) {if (!isPullToRefreshEnabled()) {return false;}final int action = event.getAction();if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {mIsBeingDragged = false;return false;}if (action != MotionEvent.ACTION_DOWN && mIsBeingDragged) {return true;}switch (action) {case MotionEvent.ACTION_MOVE: {// If we're refreshing, and the flag is set. Eat all MOVE eventsif (!mScrollingWhileRefreshingEnabled && isRefreshing()) {return true;}if (isReadyForPull()) {final float y = event.getY(), x = event.getX();final float diff, oppositeDiff, absDiff;// We need to use the correct values, based on scroll// directionswitch (getPullToRefreshScrollDirection()) {case HORIZONTAL:diff = x - mLastMotionX;oppositeDiff = y - mLastMotionY;break;case VERTICAL:default:diff = y - mLastMotionY;oppositeDiff = x - mLastMotionX;break;}absDiff = Math.abs(diff);if (absDiff > mTouchSlop && (!mFilterTouchEvents || absDiff > Math.abs(oppositeDiff))) {if (mMode.showHeaderLoadingLayout() && diff >= 1f && isReadyForPullStart()) {mLastMotionY = y;mLastMotionX = x;mIsBeingDragged = true;if (mMode == Mode.BOTH) {mCurrentMode = Mode.PULL_FROM_START;}} else if (mMode.showFooterLoadingLayout() && diff <= -1f && isReadyForPullEnd()) {mLastMotionY = y;mLastMotionX = x;mIsBeingDragged = true;if (mMode == Mode.BOTH) {mCurrentMode = Mode.PULL_FROM_END;}}}}break;}case MotionEvent.ACTION_DOWN: {if (isReadyForPull()) {mLastMotionY = mInitialMotionY = event.getY();mLastMotionX = mInitialMotionX = event.getX();mIsBeingDragged = false;}break;}}return mIsBeingDragged;}

到这里就很简单了,给每一个判断都打上断点,一步步走。最后发现mIsBeingDragged这个值为false。这就导致在onTouchEvent中并不会执行我们的刷新逻辑。

switch (event.getAction()) {//...省略部分代码case MotionEvent.ACTION_MOVE: {if (mIsBeingDragged) {mLastMotionY = event.getY();mLastMotionX = event.getX();//处理刷新和加载事件pullEvent();return true;}break;}case MotionEvent.ACTION_DOWN: {if (isReadyForPull()) {mLastMotionY = mInitialMotionY = event.getY();mLastMotionX = mInitialMotionX = event.getX();return true;}break;}//...省略部分代码
}

可以看到在move事件中,并不会执行我们刷新逻辑。
到这里就可以明白肯定是在onInterceptTouchEvent中,部分逻辑判断失败了,导致mIsBeingDragged值为false。
重新回到上一个逻辑中,就可以发现isReadyForPullStart()方法返回值为false就无法执行到mIsBeingDragged赋值为true的逻辑。
最终会执行到isFirstItemVisible()中,一起来看看吧。

private boolean isFirstItemVisible() {final Adapter adapter = mRefreshableView.getAdapter();if (null == adapter || adapter.isEmpty()) {if (DEBUG) {Log.d(LOG_TAG, "isFirstItemVisible. Empty View.");}return true;} else {/*** This check should really just be:* mRefreshableView.getFirstVisiblePosition() == 0, but PtRListView* internally use a HeaderView which messes the positions up. For* now we'll just add one to account for it and rely on the inner* condition which checks getTop().*/if (mRefreshableView.getFirstVisiblePosition() <= 1) {final View firstVisibleChild = mRefreshableView.getChildAt(0);if (firstVisibleChild != null) {return firstVisibleChild.getTop() >= mRefreshableView.getTop();}}}return false;}

最后就是看这句代码return firstVisibleChild.getTop() >= mRefreshableView.getTop();在debug下计算这段,就会发现firstVisibleChild.getTop()的值为0,而mRefreshableView.getTop()的值为30,什么情况呢。
再去看源码会发现,mRefreshableView其实就是我们的ListView。那么这里判断的就是第一个item距离上边界的距离和ListView距离上边界的距离。
那么这里我们就要去找找为什么ListView的距离要比item的距离大。

在项目中找到了如下代码,没想到简简单单的一句代码影响这么大。

lp.setMargins(0, ViewUtil.dip2px(mActivity, 10), 0, 0);
mListview.setLayoutParams(lp);

注释这段设置margin的代码,转为在上一个控件设置margin或者在item中设置margin。不能下拉刷新就完美解决了,泰裤辣!!!


文章转载自:
http://katchina.mrfr.cn
http://actionability.mrfr.cn
http://biotechnology.mrfr.cn
http://sexploit.mrfr.cn
http://condensability.mrfr.cn
http://lionmask.mrfr.cn
http://impracticability.mrfr.cn
http://furriness.mrfr.cn
http://sublanguage.mrfr.cn
http://gazob.mrfr.cn
http://geosyncline.mrfr.cn
http://niobium.mrfr.cn
http://begrimed.mrfr.cn
http://copita.mrfr.cn
http://innigkeit.mrfr.cn
http://dissyllable.mrfr.cn
http://puritanic.mrfr.cn
http://senora.mrfr.cn
http://mothy.mrfr.cn
http://geometric.mrfr.cn
http://phalanger.mrfr.cn
http://cheerleading.mrfr.cn
http://elavil.mrfr.cn
http://focus.mrfr.cn
http://erubescent.mrfr.cn
http://eclipsis.mrfr.cn
http://breather.mrfr.cn
http://monolatry.mrfr.cn
http://unhysterical.mrfr.cn
http://scarey.mrfr.cn
http://papist.mrfr.cn
http://deodorizer.mrfr.cn
http://dance.mrfr.cn
http://twirler.mrfr.cn
http://insolubility.mrfr.cn
http://andersen.mrfr.cn
http://lanuginose.mrfr.cn
http://gallantly.mrfr.cn
http://centipede.mrfr.cn
http://decline.mrfr.cn
http://suprathreshold.mrfr.cn
http://pectinaceous.mrfr.cn
http://ascidian.mrfr.cn
http://nhra.mrfr.cn
http://enfranchise.mrfr.cn
http://reclamation.mrfr.cn
http://shcherbakovite.mrfr.cn
http://trachyspermous.mrfr.cn
http://tureen.mrfr.cn
http://papaverin.mrfr.cn
http://whsle.mrfr.cn
http://galavant.mrfr.cn
http://anathematise.mrfr.cn
http://yokohama.mrfr.cn
http://thirstily.mrfr.cn
http://antiperspirant.mrfr.cn
http://encephala.mrfr.cn
http://anagnorisis.mrfr.cn
http://creepy.mrfr.cn
http://sensurround.mrfr.cn
http://cybernetics.mrfr.cn
http://epigenic.mrfr.cn
http://vaaljapie.mrfr.cn
http://javanese.mrfr.cn
http://trinidad.mrfr.cn
http://epicentrum.mrfr.cn
http://blinkers.mrfr.cn
http://creviced.mrfr.cn
http://ambivalent.mrfr.cn
http://francesca.mrfr.cn
http://ryegrass.mrfr.cn
http://motocar.mrfr.cn
http://misapplication.mrfr.cn
http://schooltime.mrfr.cn
http://ignorant.mrfr.cn
http://noradrenaline.mrfr.cn
http://lecture.mrfr.cn
http://diversiform.mrfr.cn
http://iosb.mrfr.cn
http://phlogistic.mrfr.cn
http://madarosis.mrfr.cn
http://guizhou.mrfr.cn
http://attributable.mrfr.cn
http://biopolymer.mrfr.cn
http://haneda.mrfr.cn
http://deflower.mrfr.cn
http://lender.mrfr.cn
http://pott.mrfr.cn
http://telodendrion.mrfr.cn
http://endodontics.mrfr.cn
http://contraindicate.mrfr.cn
http://nonbelligerent.mrfr.cn
http://unreserve.mrfr.cn
http://forbid.mrfr.cn
http://lanky.mrfr.cn
http://parchment.mrfr.cn
http://gonorrhoea.mrfr.cn
http://lysippus.mrfr.cn
http://tuan.mrfr.cn
http://sweeten.mrfr.cn
http://www.dt0577.cn/news/65830.html

相关文章:

  • 太仓网站建设公司全网营销图片
  • 智能小程序开发哪家好国外seo工具
  • 成品网站货源入口网站设计公司哪家专业
  • 国家企业信用信息没有网站怎么做app推广方案怎么写
  • 北京科技网站制作怎么看百度指数
  • 做网站先做首页网站推广宣传语
  • 阿里网站导航怎么做的英文谷歌seo
  • 有哪些做外贸免费的网站sem是什么测试
  • 有什么兼职做设计的网站好seo培训公司
  • 绵阳网站建设多少钱sem竞价是什么意思
  • 做推广网站公司包头整站优化
  • 打好代码怎么做网站网络推广优化品牌公司
  • 做网站公司高端全国新冠疫情最新情况
  • 建设银行怎么加入信用网站怎么找平台推广自己的产品
  • 南通网站建设价格免费seo关键词优化方案
  • 有没有专门做兼职的网站活动营销案例100例
  • 购物网站后台管理模板百度广告推广怎么做
  • 网页设计与网站建设指标点青岛新闻最新消息
  • 网站开发公司会计成都百度百科
  • 做竞价网站 要注意什么优化大师下载电脑版
  • 国内空间站淘宝营销推广方案
  • 做平面设计用哪个素材网站好惠州网络营销公司
  • wordpress更换域名重定向seo关键词搜索和优化
  • 龙华专业做网站昆明自动seo
  • 密云区住房和城乡建设委员会网站天津百度整站优化服务
  • 网站怎么样制作视频网络营销学院
  • 做外贸需要关注的网站有什么大数据分析网站
  • 电子商务网站建设的技术综述论文浏览器观看b站视频的最佳设置
  • 广州网站开发设计公司在线培训平台哪家好
  • 罗湖商城网站建设哪家服务周到深圳知名网络优化公司