为了账号安全,请及时绑定邮箱和手机立即绑定

菜单和Item位置关系

我写出来的为何  小部件Item在左下角...主菜单的按钮在右下角的

正在回答

1 回答

在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;
}

0 回复 有任何疑惑可以回复我~
#1

辰虹 提问者

非常感谢!
2016-10-20 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Android实现卫星菜单
  • 参与学习       26334    人
  • 解答问题       55    个

学习仿Path的卫星式菜单,课程涵盖了自定义控件的整个过程

进入课程

菜单和Item位置关系

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信