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