How center a text in a ImageView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How center a text in a ImageView

Postby gilardh » Sun Jan 10, 2010 5:55 pm

Hi,

Who say me how center a text in a ImageView ?

Regards
gilardh
Freshman
Freshman
 
Posts: 5
Joined: Wed May 27, 2009 10:02 pm

Top

Postby qlimax » Sun Jan 10, 2010 8:29 pm

:?:
ImageViews are made for Images... you can't set nor align text on it...
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby gilardh » Sun Jan 10, 2010 11:15 pm

OK, ImageViews are made for Images.
How to center a text above an ImageView ?
Regards
Attachments
b.jpg
Example, just want a red boule with a text center above.
b.jpg (10.07 KiB) Viewed 190 times
gilardh
Freshman
Freshman
 
Posts: 5
Joined: Wed May 27, 2009 10:02 pm

Postby qlimax » Mon Jan 11, 2010 1:19 am

I think there are two things you can do:

An easy way is to use a textview and setthe background image.

An "harder" way would be to extend the imageview class and make your own (witth text) implementation
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby Droid123 » Tue Jan 12, 2010 12:35 am

qlimax wrote:I think there are two things you can do:

An easy way is to use a textview and setthe background image.

An "harder" way would be to extend the imageview class and make your own (witth text) implementation


Do you know if there's an easy way to display a smaller image as an overlay over another image?

(like the badge count on top of an iPhone icon)

thanks
Droid123
Experienced Developer
Experienced Developer
 
Posts: 77
Joined: Sat Nov 21, 2009 1:21 pm

Postby Fonceur » Tue Jan 12, 2010 12:53 am

Droid123 wrote:Do you know if there's an easy way to display a smaller image as an overlay over another image?

With an ImageButton, you can specify the background and src, which would do what you want, maybe use the layout_padding if needed... Not sure if ImageView can do that too...
Fonceur
Junior Developer
Junior Developer
 
Posts: 18
Joined: Sun Jan 10, 2010 8:53 pm

Top

Postby qlimax » Tue Jan 12, 2010 1:00 am

Anyway, you can try doing some overlaying with RelativeLayout or FrameLayout.
here is an example
http://android-developers.blogspot.com/ ... ze-by.html
(ok forget about optimization)
but he make some overlaying.... isn't it ? :idea:
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests