如何TextView的旋转90度,显示 [英] How to Rotate TextView 90 Degrees and display

查看:979
本文介绍了如何TextView的旋转90度,显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况,图形页面,在这里的LinearLayout应显示为90度的旋转的TextView

i am having a situation in Graph page where LinearLayout should display the TextView with 90 Degrees rotated.

希望我的问题是清楚的,如果不是请让我知道。

Hope my question is clear if not please let me know.

推荐答案

最快,最方便的方法就是旋转动画

The fastest and most convenient way is to Rotate by Animation

使用旋转动画在你的常规的TextView像这样。

use rotate animation on your regular TextView like so.

rotateAnimation.xml:

rotateAnimation.xml:

<rotate  xmlns:android="http://schemas.android.com/apk/res/android"
           android:fromDegrees="0" 
           android:toDegrees="-90"
           android:pivotX="50%"
           android:duration="0"
           android:fillAfter="true" />

Java的code:

Java Code:

  TextView text = (TextView)findViewById(R.id.txtview);       
  text.setText("rotated text here");

  RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation);
  text.setAnimation(rotate);

这篇关于如何TextView的旋转90度,显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆