int width = getWindowManager().getDefaultDisplay().getWidth();
int height = getWindowManager().getDefaultDisplay().getHeight();
int w = (int) (((float)width / 100) * 20);
int h = (int) (((float)(height / 200)) * 40);
Toast.makeText(this, width + ":" + height + "\n" + w + ":" + h, Toast.LENGTH_LONG).show();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)mRoundView.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.rightMargin = w;
params.topMargin = h;
mRoundView.setLayoutParams(params);
自己存档
最新推荐文章于 2020-11-25 23:07:09 发布