旋转中 android 的视图按钮
推荐安卓开发神器(里面有各种UI特效和android代码库实例)
我想要旋转 45 度的视图按钮。为此我写的代码,如下所示。现在旋转按钮本身,而不是文本或按钮上的标签是获取旋转。但我希望该按钮以获取旋转 45 度。如何可以完成这个。
公共类 MyButton 扩展按钮 {
public float degrees;
public float sWidth;
public float sHeight;
public MyButton(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
canvas.save();
canvas.rotate(45.0f);
super.onDraw(canvas);
canvas.restore();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
// TODO Auto-generated method stub
super.onSizeChanged(w, h, oldw, oldh);
sWidth=w;
sHeight=h;
}
}
相关推荐
Nostalgiachild 2020-11-13
韩伟佳 2020-10-09
wuleihenbang 2020-09-16
zzqLivecn 2020-07-09
chenjinlong 2020-06-10
yinbaoshiguang 2020-06-09
sgafdsg 2020-06-04
ustcrding 2020-06-03
chenjinlong 2020-06-03
AndroidGA 2020-06-01
安辉 2020-05-27
绿豆饼 2020-05-26
CNETNews 2020-05-26
xilove0 2020-05-12
绿豆饼 2020-05-12
ChainDestiny 2020-05-07
doomvsjing 2020-05-07
hqulyc 2020-05-05
lyccsu 2020-04-30