如何制作一个自定义的Edittext,使它看起来像在Android中旋转45度

Tri*_*ahu 2 android android-widget android-emulator android-layout

如何制作一个自定义的Edittext,以便它看起来像在Android中旋转45度,它应该是可编辑的,以便用户可以在旋转的Edittext上输入文本.我试过了.但我没有得到任何解决方案.请给出一些想法来做到这一点.

nul*_*ent 5

您可以尝试重写EditText onDraw方法,如此...

@Override
protected void onDraw(Canvas canvas) {
     canvas.save();
     canvas.rotate(45.0f,xpivot,ypivot); //rotate around (x,y) pivot point 
     super.onDraw(canvas);
     canvas.restore();
}
Run Code Online (Sandbox Code Playgroud)

我没有测试过这个,但我认为它应该可行.