chadh0130
Apple Fan
Profile
Posts: 352
Reg: Nov 05, 2011
Rhode Island
4,020
11/18/12 03:49 PM (13 years ago)

How to customize (android) menu buttons layout

I have customized home page image that uses the menu button screen. I wanted the ability to add invisible buttons over top of the image rather than having square buttons on the screen. I am curious, is there a way to push the buttons down from the top of the screen like you can do with xcode? I have been looking around the menuButtons files in android and can't really grasp what I need to edit. Has anyone had any success editing the menu buttons file using an image as a background?
 
ZeesApps
Veteran developer
Profile
Posts: 23
Reg: Sep 28, 2012
Tarxien, Malta
4,130
like
11/20/12 04:05 AM (13 years ago)
If you use a program called photoscape (for windows, a free download), you can split your image into sections... use each section as a button, and that's it.... You need to prepare the image beforehand obviously, as well as the locations where the picture is to be split... This could be an 80pixel high image that is split into 4 parts of 20pixels each. Make each button background image the same split images...
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
11/20/12 07:25 AM (13 years ago)
Great advice and resource @ZeesApps! I will also try it out. LA
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
11/27/12 06:24 AM (13 years ago)
@WaYsTiiD TIME .. i meant to answer this thread last week but my computer wasnt quite set up. Here is how I customized the menu button padding to be aligned slighty in the middle of the button grid screen. Go to around line: 442 in the src/BT_screen_menuButtons.java file //table row holds parts... TableRow tr = null; if(tmpRowCounter < buttonsPerRow){ tr = new TableRow(this); tr.setLayoutParams(trLp); tr.setPadding(0, 0, 0, 0); } For my app I changed the value in the tr.setPadding from (0,0,0,0) to the following: tr.setPadding(10, 350, 20, 50); That should give you room to make changes based on your needs! I hope it helps
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
11/27/12 07:04 AM (13 years ago)
@mysps, Loving the resource here and the advice! LA
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/15/13 09:45 PM (13 years ago)
So, mysps thank you for guiding us to where we could center buttons on all Android devices. Here is my very limited ability to communicate what each of the four values mean that mysps included in his explanation. first value left margin second value, top. all rows will get lower together when value goes higher Second to last value cuts off on the right side if larger than 20 Last value, between rows. Higher value larger margin between
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/16/13 09:04 AM (13 years ago)
@eJucomm .. no, thank you for explaining the each placement for the values. I will update my tutorial with your explanation above. Thanks!
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/21/13 07:43 PM (13 years ago)
Mysps, I was so excited when the Android emulator and on a device reflected my placement values. It worked like a charm. However, the app keeps crashing and it does show me that is the button menu layout. I have to assume it was because of my changes because I have done nothing else different. Any advice? Should I have done something different? Thanks! java.lang.RuntimeException: Unable to start activity ComponentInfo{com.encore/com.encore.BT_screen_menuButtons}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083) at android.app.ActivityThread.access$600(ActivityThread.java:134) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4697) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.encore.BT_screen_menuButtons.layoutButtons(BT_screen_menuButtons.java:456) at com.encore.BT_screen_menuButtons.parseScreenData(BT_screen_menuButtons.java:943) at com.encore.BT_screen_menuButtons.onStart(BT_screen_menuButtons.java:239) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133) at android.app.Activity.performStart(Activity.java:4549) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2022) ... 11 more
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/21/13 08:06 PM (13 years ago)
hmm.. i haven't seen that happen for me. Not sure what it could be. Have you cleaned and copied the config? how many menu items do you have? i've only tried with maximum 4. But it shouldn't matter I guess. Do you have any other warnings? You say you haven't changed anything else? Try creating a new project. From the error log im honestly unable to tell exactly
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/21/13 08:07 PM (13 years ago)
this line: Caused by: java.lang.NullPointerException what plugins are you using in the button menu?
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/21/13 09:06 PM (13 years ago)
Not sure what plug in I am using as I had my control panel set up. I have six buttons and no I did not copy and configure the config. I will try that and keep you updated.
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/21/13 09:08 PM (13 years ago)
Not sure what plug in I am using as I had my control panel set up. I have six buttons and no I did not copy and configure the config. I will try that and keep you updated.
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/21/13 09:18 PM (13 years ago)
Not sure what plug in I am using as I had my control panel set up. I have six buttons and no I did not copy and configure the config. I will try that and keep you updated.
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/21/13 09:20 PM (13 years ago)
Not sure what plug in I am using as I had my control panel set up. I have six buttons and no I did not copy and configure the config. I will try that and keep you updated.
 
eJucomm
Aspiring developer
Profile
Posts: 73
Reg: Nov 22, 2010
McAllen
730
like
01/21/13 09:24 PM (13 years ago)
I don't know why it keeps posting!
 
mysps
Code is Art
Profile
Posts: 2082
Reg: May 14, 2011
Palma
33,320
like
01/21/13 10:02 PM (13 years ago)
if you come back to the page and click refresh that usually makes the page duplicate your last post. have you gotten any further?
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
01/22/13 06:42 AM (13 years ago)
Hi @eJucomm, Your posting showed this: at com.encore.BT_screen_menuButtons.layoutButtons(BT_screen_menuButtons.java:456) What are the names of your buttons? Did you put them in your project? LA
 

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.