Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 8    Views: 72

LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
01/19/13 10:33 AM (13 years ago)

Menu with image issue

Hi, I'm using the menu with image plug in a lot in my app. It's working beautifully in iOS, but in Android the header image isn't auto-rescaling to the screen size. I'm using the specified 1536(w) x 720(h) but it doesn't look quite right with the image only taking up approx. half the width of the screen, though it is centred. Any ideas? Thanks
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/19/13 01:15 PM (13 years ago)
It would depend on the device you have. On my wife's Galaxy Nexus, it looks perfect. On an iPhone it looks perfect. On my Galaxy Tab 2, it looks the same as you describe. The way it works is, the '1536 x 720' autosizes both horizontally and vertically, and sizes itself proportionately; if it reaches a 'vertical limit' it stops resizing. If it reaches a horizontal limit, it stops resizing. The only way you're going to be able to get 'everything' perfect is to resize each device layout and make the appropriate changes. I make my images half size (1536x 360) so that they're thinner. Otherwise, it's personal preference, and a little trial and error. Good Luck! Cheers! -- Smug
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
01/19/13 09:34 PM (13 years ago)
@SmugWimp Is that why you change the height from 90dip to 75 dip? (Noticed that change in your Android checklist the other day) Cheers Darrel
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/19/13 09:41 PM (13 years ago)
It is originally 150, and I halve it to 75. (iPhone) wb_screen_menuimage.m imageHeight=180 & 75 (ipad/iphone) (Android) screen_wb_menuimage.xml = android:layout_height="75dip" I recently started making my images 768 x 180, even smaller, since it's the same proportion and makes the image filesize a little smaller, while still being attractive on larger screens... I change the height primarily because I use that space as an ad banner, and the original image size is about 30% of the total screen available, way too big for my taste, although I don't mind the size in 'non commercial' applications. Cheers! -- Smug
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
01/19/13 09:52 PM (13 years ago)
Thanks Smug, That makes sense. I change the xml on Menu With Image for my Android projects too. I usually use the code below instead of specifying a height. android:adjustViewBounds="true" This makes the image scale until it hits the sides AFAIK. cheers
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/19/13 10:05 PM (13 years ago)
Do you replace android:layout_height="xxxdip" with android:adjustViewBounds="true" or do you "Add" the code? Cheers! -- Smug
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
01/19/13 10:22 PM (13 years ago)
This seems to work for me. I've spent hours trying different Android properties but this seems to work on my test devices and AVD's. <ImageViewxmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/headerImageView" android:layout_width="fill_parent" // change layout height to wrap_content android:layout_height="wrap_content" android:scaleType="center" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" // add adjust views bounds android:adjustViewBounds="true"> </ImageView> I'd be interested to hear if this works for you or any any further ideas you may have. cheers
 
LAS
I hate code!
Profile
Posts: 34
Reg: Apr 03, 2012
location unknow...
10,340
like
01/20/13 05:34 AM (13 years ago)
Thanks for your help Smug and ict. I'll give these suggestions a go!
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
02/20/13 12:18 PM (12 years ago)
Wow. Big difference, very nice. Tim
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.