Android之scrollview底部继续拖动查看图文详情
来源:互联网 发布:node.js硬实战115 pdf 编辑:程序博客网 时间:2024/06/11 19:59
-----------------转载请注明出处:http://blog.csdn.net/android_cll
一:效果图、
二:实现步骤:
1.xml布局的实现、
<ScrollView
android:id="@+id/mymyscrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/rejcdosjflk"
android:background="#ffffff"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
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;
}
}
};
有用的看一下,很简单。。。。。。。。。
3 0
- Android之scrollview底部继续拖动查看图文详情
- ScrollView 继续上拉查看图文详情
- android向上拖动查看图文详情控件
- Android--仿淘宝商品详情(继续拖动查看详情)及标题栏渐变
- Android--仿淘宝商品详情(继续拖动查看详情)及标题栏渐变
- Android--仿淘宝商品详情(继续拖动查看详情)及标题栏渐变
- android 仿淘宝、京东商品详情页 向上拖动查看图文详情控件
- android 仿淘宝、京东商品详情页 向上拖动查看图文详情控件
- Android--仿QQ空间动态页(继续拖动查看详情)及标题栏渐变
- 仿淘宝商品详情页中(继续拖动到图文详情)
- js实现类似淘宝继续拖动查看详情的弹簧效果
- Android实现上拉查看图文详情的一种想法
- android 仿京东上拉加载图文详情
- 仿淘宝的继续拖动显示详情页面
- 淘宝上拉查看图文详情效果
- 利用scrollView实现拖动一段距离,显示下方更多详情
- android之scrollview滑动和地图拖动冲突
- android ScrollView滚动到底部
- Linux 杀同一个关键词的多个进程
- Jenkins-Requeue Job
- asch相关的linux基础知识分享
- iOS10里的通知与推送
- SOA架构
- Android之scrollview底部继续拖动查看图文详情
- spring3.x第七章 基于@AspectJ和Schema的AOP
- range()函数用法
- Dynamics 365 for Sales:轻松搭建自己的企业门户
- 51nod 1781 Pinball
- Java中对象的上转型对象
- Two pointers
- python-add character on image
- C++ 转向语句:break continue goto return