Androidscrollview实现底部继续拖动查看图文详情
本文实例为大家分享了Android实现底部拖动查看图文详情的具体代码,供大家参考,具体内容如下
创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都网站设计、网站建设、大宁网络推广、小程序定制开发、大宁网络营销、大宁企业策划、大宁品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供大宁建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com
一、效果图
二、实现步骤
1.xml布局的实现/p>
2.activity的实现
private ScrollView mScrollView; mScrollView = (ScrollView) findViewById(R.id.mymyscrollview); //调用方法 mScrollView.setOnTouchListener(new TouchListenerImpl()); private int scrollY; private int height; private int scrollViewMeasuredHeight; private class TouchListenerImpl implements View.OnTouchListener { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_MOVE: scrollY = view.getScrollY(); height = view.getHeight(); scrollViewMeasuredHeight = mScrollView.getChildAt(0) .getMeasuredHeight(); break; case MotionEvent.ACTION_UP: System.out.println("scrollY=" + scrollY); System.out.println("height=" + height); System.out.println("scrollViewMeasuredHeight=" + scrollViewMeasuredHeight); if (scrollY == 0) { System.out.println("滑动到了顶端 view.getScrollY()=" + scrollY); } else if ((scrollY + height) >= scrollViewMeasuredHeight) { Message msg = new Message(); msg.what = 0; mHandlerht.sendMessage(msg); } else { System.out.println("滑动 height=" + height); } // 复位 scrollY = 0; height = 0; scrollViewMeasuredHeight = 0; break; default: break; } return false; } } private Handler mHandlerht = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case 0: // 跳转 Intent intentcll = new Intent(); intentcll.setClass(BDDetialActivityCll.this, CSProductDetailsCll.class); intentcll.putExtra("product", ncspbean); startActivity(intentcll); break; default: break; } } };
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。
分享题目:Androidscrollview实现底部继续拖动查看图文详情
文章网址:http://pwwzsj.com/article/pdgipj.html