2016-07-05 12 views
1

テキストを下から上に斜め45度で表示しようとしています。私はSetRotation("45")android:rotation="45"を試してみましたし、またその斜めで表示されないこのテキストビューで斜め45度のテキストを表示する

<item> 
    <rotate 
     android:fromDegrees="-45" 
     android:toDegrees="45" 
     android:pivotX="20%" 
     android:pivotY="20%" > 
     <shape 
      android:shape="line" 
      android:top="1dip" > 
      <stroke 
       android:width="1dip" 
       android:color="#0000" /> 
     </shape> 
    </rotate> 
</item> 

のようなXMLでのアニメーションを試してみました。もしあなたが何かを助けてください、斜めにテキストを表示する方法。前もって感謝します。

+0

を助けることができるかもしれ 結果はどうでしたか? – Silwester

答えて

0

45 degressの回転を与えることが-45度のためのに対し、上から下にテキストを回転させるには、あなたがこのようなランタイムを回転させることができます設定

<TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:rotation="-45" 
      android:text="HERE" 
      android:textColor="#000" 
      /> 
+0

詳細を編集してください。コード専用と「試してください」の回答は、検索可能なコンテンツが含まれていないため、推奨されません。なぜ誰かが「これを試してみる」べき理由を説明しません。私たちはここで知識のためのリソースとなるよう努力しています。 – abarisone

1

を下から上に向かって回転します。.. のようにフォルダを作成しますこれは/アニメーション/および追加xmlファイル rotate_diagonally.xml決断:

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

設定ランタイムJavaコードで

TextView textview = (TextView)findViewById(R.id.txtview);  

    RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotate_diagonally); 
    textview.setAnimation(rotate); 

それは。これは私のために働いた

関連する問題