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