課程
/移動開發
/Android
/不一樣的自定義實現輪播圖效果
老師手動無限輪播應該怎么加
2017-03-09
源自:不一樣的自定義實現輪播圖效果 2-5
正在回答
case MotionEvent.ACTION_UP:// 手指立刻
int scrollX = getScrollX();// 獲得滑動距離
index = (scrollX + childwidth / 2) / childwidth;// 獲得索引值
if (index < 0) {
index = childcount - 1;// 說明已經滑到了最左邊一張圖片
} else if (index > childcount - 1) {
index = 0;// 說明已經滑到了最右邊的一張圖片
}
鄭霖
舉報
Android開發自定義實現輪播圖效果案例實現,從無到有讓你會懂會用
1 回答用這種方法能實現,無限循環輪播么
1 回答輪播圖顯示不全
2 回答開啟輪播圖sendEmptyMessage()方法錯誤
1 回答為什么我的輪播圖不能占滿屏幕
1 回答為什么imagebarnnerviewgroup的外套要一個viewpager就顯示不了圖片輪播
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-03-18
case MotionEvent.ACTION_UP:// 手指立刻
int scrollX = getScrollX();// 獲得滑動距離
index = (scrollX + childwidth / 2) / childwidth;// 獲得索引值
if (index < 0) {
index = childcount - 1;// 說明已經滑到了最左邊一張圖片
} else if (index > childcount - 1) {
index = 0;// 說明已經滑到了最右邊的一張圖片
}