Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 18    Views: 116

satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
04/08/13 04:21 AM (12 years ago)

Menu with Image plugin

Hi, I have two problem as following: 1. When i put a header image with URL image:http://www.freedomwallpaper.com/nature-wallpaper/nature-hd-wallpapers-water.jpg (1,920px × 1,200px ). it's show small image in my device and emulator. Why not show full or fit in my device and emulator. 2. I put an menu icons (100px X 100px). it's show only emulator not in my android device(galaxy SIII). How to fix the problems. Thank you in advance. Satit P.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/08/13 05:10 AM (12 years ago)
1). Your header image gets resized to a certain height, regardless of the width. You should create a header image that fits the dimensions specified on the control panel settings for the plugin. 2). Make sure your images are in the res/drawable folder in Eclipse. You have to manually drag them in
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/08/13 05:33 AM (12 years ago)
hi, Well , now problem no 2 solved by follow your instruction. But for problem no.1 not yet, i want my header image full in from the left to the right(auto stretch width) no space, like a sample pictures which show in the Menu with Image plugin page. i'd follow created a image as default size is 1536(w) x 720(h) pixels from the control panel and create a more bigger. Then the result still the same. It's not fit in my device. How to fix that? Satit P.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/08/13 05:46 AM (12 years ago)
Not sure what you mean by "create a more bigger". You should keep the same dimensions as the default (1536x720), or resize by the same ratio. You probably don't want an image bigger than that though - it will cause memory issues.
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/08/13 05:57 AM (12 years ago)
Well, please see my pictures below: 1. Default Header Image https://www.buzztouch.com/applications032613/JA1B77133C93DE7766EEBA0BF/images/Screenshot_2013-04-08-19-51-03.png 2. My Header Image 536(w) x 720(h) https://www.buzztouch.com/applications032613/JA1B77133C93DE7766EEBA0BF/images/Screenshot_2013-04-08-19-50-27.png Like i said, i want my header image full in from the left to the right(auto stretch width) no space, like a sample pictures which show in the Menu with Image plugin page. How to do that? Thank you in advance. Satit P.
 
jvalley
Aspiring developer
Profile
Posts: 456
Reg: Feb 16, 2013
Green Bay,Wi
9,360
like
04/08/13 06:17 AM (12 years ago)
I believe its because you are emulating on a larger device. If you would put it on a phone it will cover the left to right. with so many android devices it will be very difficult to get them to look the same. I am thinking you are using a nexus 7 or some other tablet for emulator. again once it goes on a smaller phone it will fit
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/08/13 06:24 AM (12 years ago)
Yeah - it looks like you're achieving the same results with your image as you do with the default image - it's just that you want something different than what the standard code provides for. Sounds like you'll need to dig into the code.
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/08/13 06:40 AM (12 years ago)
@jvalley: you are correct, I use Galaxy S3 bigger a bit for normal phone. @Chris1: i want to make android app for my student who almost using tablet from china. Can you advice how to adjust the code for the header image fit in tablet. Thank you in advance Satit P.
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/08/13 07:36 AM (12 years ago)
@jvalley: you are correct, I use Galaxy S3 bigger a bit for normal phone. @Chris1: i want to make android app for my student who almost using tablet from china. Can you advice how to adjust the code for the header image fit in tablet. Thank you in advance Satit P.
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
04/08/13 12:51 PM (12 years ago)
One trick to avoid changing any code: If the header image has a constant color around it's border you can make that same color the menu_with_image screen's background color. The color will then fill in on the sides where you see the black bars in your screenshot, looks like it is filling the width with the image. So, if your image has a white background, make the menu screen's background color white. If your image has a black background, make your menu screen background color black... etc. Tim
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/13/13 10:12 PM (12 years ago)
Satit: Just to follow up - I think I found the issue. In the main XML file for the plugin (WB_screen_menuImage.xml), you'll find the following line under the <ImageView section: android:scaleType="fitCenter" Change that to read: android:scaleType="fitXY"
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/13/13 10:45 PM (12 years ago)
Hi Chris1, after open res/layout/wb_screen_menuimage.xml with eclipse, then the cross red ,error mark, show at once. i solved it by delete project and re-create again. after run the project with "fitXY" in emulator the result still the same. no effect.
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
04/20/13 07:09 AM (12 years ago)
@chris1 Wow, I found the solution that meet my requirement. I changed the code as the following: ... android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="fitCenter" > ... And i prepared a png image with size:1498x300px for the Header image. The result of all my devices,(galaxy S3, Tablet from china), show header image correctly both vertical and horizontal. May The owner of Menu with Image plugin should changed his code according i mention. Thank you very much again!!!
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
05/22/13 09:00 AM (12 years ago)
@satit .. I've tried both your and @chris1's fix but I'm clueless why it doesn't work on my LG L9.. Hmm.. Here is what I have tried. Please correct me where I've made an error .. chris1's code: <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/headerImageView" android:layout_width="fill_parent" android:layout_height="150dip" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:scaleType="fitXY" > </ImageView> ------------------ satit's code <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/headerImageView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="fitCenter" > </ImageView> If you could help out i'd appreciate it! thx
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
05/22/13 09:06 AM (12 years ago)
nevermind.. i realized (although not posted here) that i had to add the fit_xy to the menu with image java file. from: (ImageView.ScaleType.FIT_CENTER); to: (ImageView.ScaleType.FIT_XY); along with the scaletype from chris1 above: android:scaleType="fitXY" I'm going to edit that file on my server and try my best to remember during any updates lol hope that helps someone else
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/22/13 09:18 AM (12 years ago)
glad you got it working!
 
satit
I hate code!
Profile
Posts: 89
Reg: Feb 16, 2012
bangkok
6,640
like
05/22/13 06:26 PM (12 years ago)
@mysps Sorry to reply lately. Before i made the last post. I use the way trial and error. I changed on scaleType,layout_height, layout_width. both with command and GUI for selected the best result on my tablet. Yes it's work now In your case LG device, scaleType="fitXY" it seem to work best with your LG. Don't forget to using the way "trial and error". That the good way which i had learnt form the buzztouch. Glad to see it work for you.
 
bizappsmedia
buzztouch Evangelist
Profile
Posts: 39
Reg: Nov 21, 2012
San Diego,CA
6,590
like
04/15/15 09:54 AM (10 years ago)
Hi everyone, I just wanted to add to the conversation here. I was able to add one more line to the xml. I set android:adjustviewbounds to TRUE in the properties area. This is how it looks in the xml: <ImageView android:id="@+id/headerImageView" android:layout_width="fill_parent" android:layout_height="150dip" android:onClick="headerOnClick" android:scaleType="fitXY" android:adjustViewBounds="true"> </ImageView> I'm getting good results in the scaling for any device I choose. Here's the link from stackflow: http://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio Hope this helps!
 
bizappsmedia
buzztouch Evangelist
Profile
Posts: 39
Reg: Nov 21, 2012
San Diego,CA
6,590
like
04/15/15 10:04 AM (10 years ago)
Hi everyone, I just wanted to add to the conversation here. I was able to add one more line to the xml. I set android:adjustviewbounds to TRUE in the properties area. This is how it looks in the xml: <ImageView android:id="@+id/headerImageView" android:layout_width="fill_parent" android:layout_height="150dip" android:onClick="headerOnClick" android:scaleType="fitXY" android:adjustViewBounds="true"> </ImageView> I'm getting good results in the scaling for any device I choose. Here's the link from stackflow: http://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio Hope this helps!
 

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.