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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
"Custom EditText" means you extend EditText and you override the draw method, drawing the text the way you want it.
回答3:
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);