Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 68

LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
10/04/13 04:06 PM (12 years ago)

row icon margin android

Hey there, still seem to be some problems witht the menu with image and menu with image advanced. On my Galaxy S2 everything looked fine, but on my Galaxy S4 the row description overlapped my row icons. I went in the code as usual and can change the leftMargin but that only solves it for the big device Galaxy S4 but makes the Galaxy S2 look stupid. See what I mean here: http://www.appkingz.de/downloads/rowiconprob.jpg I think there should be a line added that "if it is a large device" the margin should be bigger, or percentages if possible. The code to change the margin is in the WB_screen_menuimage.java in here: //added by SAS ///Set location for text if there is or is no icon if(icon == null){ RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.leftMargin = 5; lp.rightMargin = 45; lp.addRule(RelativeLayout.CENTER_VERTICAL); titleView.setLayoutParams(lp); descriptionView.setLayoutParams(lp); }else { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.leftMargin = 150; lp.rightMargin = 45; lp.addRule(RelativeLayout.CENTER_VERTICAL); titleView.setLayoutParams(lp); descriptionView.setLayoutParams(lp); } The leftmargin 150 is the change made to have it like in the screenshot. On another note, the header images never stretch to the screensize on these bigger devices either as you can see. Normally no problem, but these big Galaxy S4´s and similar devices are the Android flagships and buzztouch apps should also look good on them which is not the case right now. (at least if you have the menu with image) Hope Susan or Chris can work it out :-)
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
10/04/13 06:57 PM (12 years ago)
This code I landed on for the new Android build for the new Android core. It looked ok on my Samsung Galaxy S2 (4.0.4), Galaxy S3 (4.1.1) and Nexus 7 (4.2). The problem is that the margins in java are set in pixels. The Menu Image Advanced by Chris1 sets the sizes in the XML using dp, and in that way it is "advanced". ///Set location for text if there is or is no icon (SAS) if(iconView == null){ BT_debugger.showIt(fragmentName + ": There is no icon so setting text at left margin."); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.leftMargin = 5; lp.rightMargin = 55; lp.addRule(RelativeLayout.CENTER_VERTICAL); titleView.setLayoutParams(lp); descriptionView.setLayoutParams(lp); }else{ BT_debugger.showIt(fragmentName + ":There is an icon so setting text to the left of the icon."); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.leftMargin = 105; lp.rightMargin = 55; lp.addRule(RelativeLayout.CENTER_VERTICAL); titleView.setLayoutParams(lp); descriptionView.setLayoutParams(lp); }
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/04/13 11:12 PM (12 years ago)
So you are saying I should change my code part to the one you posted?
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/07/13 10:15 AM (12 years ago)
I see, menu image advanced does not have these problems.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
10/07/13 11:11 AM (12 years ago)
That is exactly right. At one time I was planning to switch to setting to the XML, like in the Menu Image Advanced. However, if I were to switch the Menu with Image to the way Chris is doing it, then all of the past users would have to select a row layout type. Until they did so, their rows would display with the default option. So that is the reason why I haven't switched to Chris' mechanism.
 
S-George
Apple Fan
Profile
Posts: 111
Reg: Jan 18, 2012
location unknow...
4,460
like
10/31/13 05:57 PM (12 years ago)
Sorry didn't understand. Having the same problem with the menu with image on Galaxy s4 (row description overlapped my row icons) Is there a way to fix that?
 
cl8
Aspiring developer
Profile
Posts: 18
Reg: Sep 12, 2012
Windsor Ontario
5,280
like
11/08/13 09:37 AM (12 years ago)
I am also having this issue with the Menu with Image plugin. It works fine on a Samsung S2 but on a Samsung S3 the text is cut off by the Icon. I would really like to be able to fix this. Does anyone have any ideas.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
11/08/13 09:46 AM (12 years ago)
Is your project a new one? I move the icon over in the last update to the plugin. So the manual change should no longer be necessary.
 

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.