Hi all,i want to display text on image view.
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
You can create a new class derived from ImageView. Override the onDraw method, drawing the parent class first and then your own text.
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.
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.