国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Android > 正文

Android scrollview實現(xiàn)底部繼續(xù)拖動查看圖文詳情

2019-10-21 21:25:20
字體:
供稿:網(wǎng)友

本文實例為大家分享了Android實現(xiàn)底部拖動查看圖文詳情的具體代碼,供大家參考,具體內(nèi)容如下

一、效果圖

Android,scrollview,拖動,查看

二、實現(xiàn)步驟

1.xml布局的實現(xiàn)/p>

<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的實現(xiàn)

private ScrollView mScrollView;mScrollView = (ScrollView) findViewById(R.id.mymyscrollview);//調(diào)用方法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);    }    // 復(fù)位    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:    // 跳轉(zhuǎn)    Intent intentcll = new Intent();    intentcll.setClass(BDDetialActivityCll.this,      CSProductDetailsCll.class);    intentcll.putExtra("product", ncspbean);    startActivity(intentcll);    break;   default:    break;  } }};

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網(wǎng)。


注:相關(guān)教程知識閱讀請移步到Android開發(fā)頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 新宾| 长乐市| 体育| 南木林县| 搜索| 石阡县| 贞丰县| 且末县| 南江县| 衢州市| 林芝县| 平舆县| 沽源县| 宁都县| 丹寨县| 张家界市| 玉龙| 肇源县| 巨野县| 建宁县| 莱阳市| 嘉兴市| 和平区| 贵定县| 仁怀市| 贵德县| 麟游县| 汉阴县| 洪湖市| 阿瓦提县| 广宗县| 连云港市| 尚义县| 北辰区| 苗栗县| 福泉市| 昌图县| 大连市| 牟定县| 福安市| 于田县|