tags:

views:

371

answers:

4

Hi all,i want to display text on image view.

+1  A: 

you'll have to subclass it and overload the onDraw method, then draw on the graphic context using the paintString method.

or just overlay a label over the ImageView

Reflog
thank you very much
deepthi
+2  A: 

You can create a new class derived from ImageView. Override the onDraw method, drawing the parent class first and then your own text.

Maurits Rijk
thank you very much
deepthi
+1  A: 

Couldn't he just put an ImageView and a TextView in a RelativeLayout and set the layout_align properties of one of them to reference the other view so they will simply overlap each other or am I missing something? Seems more simple to me.

ChristianS
+1  A: 

Not sure how much this would apply but if you're trying to do this (pseudo code):

<LinearLayout>
    <TextView />
    <ImageView />
</LinearLayout>

As you're discovering, you'll have issues doing that, if you change it to be this though:

<LinearLayout Background="YourImagePath">
    <TextView />
</LinearLayout>

You'll probably find that easier.

Assuming that you're not after creating a derived type and painting yourself as others are suggesting.

TreeUK