課程
/移動(dòng)開發(fā)
/Android
/Android實(shí)現(xiàn)衛(wèi)星菜單
我寫出來的為何 ?小部件Item在左下角...主菜單的按鈕在右下角的
2016-06-14
源自:Android實(shí)現(xiàn)衛(wèi)星菜單 1-7
正在回答
在onLayout中,畫圖的坐標(biāo)你寫的不對。老師這樣寫,只是對應(yīng)特殊情況,你寫錯(cuò)了其中一個(gè)位置。用下面的代碼對應(yīng)所有情況
if (mPosition == Position.LEFT_BOTTOM){ ? ?ct = getMeasuredHeight() - cHeight - ct;}else if (mPosition == Position.RIGHT_TOP){ ? ?cl = getMeasuredWidth() - cWidth - cl;}else if (mPosition == Position.RIGHT_BOTTOM){ ? ?ct = getMeasuredHeight() - cHeight - ct; ? ?cl = getMeasuredWidth() - cWidth - cl;}
辰虹 提問者
舉報(bào)
學(xué)習(xí)仿Path的衛(wèi)星式菜單,課程涵蓋了自定義控件的整個(gè)過程
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-07-08
在onLayout中,畫圖的坐標(biāo)你寫的不對。老師這樣寫,只是對應(yīng)特殊情況,你寫錯(cuò)了其中一個(gè)位置。用下面的代碼對應(yīng)所有情況
if (mPosition == Position.LEFT_BOTTOM){
? ?ct = getMeasuredHeight() - cHeight - ct;
}else if (mPosition == Position.RIGHT_TOP){
? ?cl = getMeasuredWidth() - cWidth - cl;
}else if (mPosition == Position.RIGHT_BOTTOM){
? ?ct = getMeasuredHeight() - cHeight - ct;
? ?cl = getMeasuredWidth() - cWidth - cl;
}