How to make a custom Edittext,so that it will look like as 45 degree rotated in android and it should editable so that th euser can enter text on that rotated Edittext.I tried it.But I am not getting any solution for it.Please give some idea to do this.
Asked
Active
Viewed 504 times
2
-
3On API Level 11+, use [`setRotation()`](http://developer.android.com/reference/android/view/View.html#setRotation(float)) on a regular `EditText`. – CommonsWare Jun 19 '12 at 16:36
3 Answers
5
You could try overriding EditText onDraw method like so...
@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();
}
I haven't tested this, but I think it should work.

nullpotent
- 9,162
- 1
- 31
- 42
-
This will do it. To clarify, you will have to write a custom `RotatedEditText extends EditText` and this + constructors can be the only thing in it. – edthethird Jun 19 '12 at 16:27
-
1I think you will have to do some additional work related to touch events, though. All you are doing is *drawing* the widget rotated. – CommonsWare Jun 19 '12 at 16:35
-
0
"Custom EditText" means you extend EditText and you override the draw method, drawing the text the way you want it.

Christine
- 5,617
- 4
- 38
- 61
0
I find a different way and it is working.
EditText lEditTxt = (EditText)findViewById(R.id.Edit_ID);
Animation lAnim = new RotateAnimation(0, -45, 250, 50);
lAnim.setRepeatCount(Animation.INFINITE);
lEditTxt.startAnimation(lAnim);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

Tripaty Sahu
- 955
- 4
- 13
- 32