2

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.

Tripaty Sahu
  • 955
  • 4
  • 13
  • 32
  • 3
    On 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 Answers3

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
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