Put rotated text on an imageview
Hi i need to put some text over an imageview.
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:src="@drawable/bg"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TEST"
/>
But this doesnt displays the text only the picture. And also I have to rotated this te开发者_运维技巧xt. Is this even possible with TextView?
There's nothing in the default TextView implementation that allows you to rotate the text. You will have to create your a custom view. Take a look at this question: Vertical (rotated) label in Android.
In that case, I think it'd be much easier to modify the bitmap representation of the ImageView
and add the rotated text (which you can do using the Canvas
methods like rotate, restore, etc... you can easily find information about that on Google).
精彩评论