开发者

Put rotated text on an imageview

开发者 https://www.devze.com 2023-01-26 18:22 出处:网络
Hi i need to put some text over an imageview. <ImageView android:layout_width=\"fill_parent\" android:layout_height=\"fill_parent\"

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

0

精彩评论

暂无评论...
验证码 换一张
取 消