Good morning. nice to meet you.
Like the picture above, the menu bar is basically used in Android.
Is there any layout source code like above in processing?
Or is there source code to make it like this?
Help me please.
Good morning. nice to meet you.
Like the picture above, the menu bar is basically used in Android.
Is there any layout source code like above in processing?
Or is there source code to make it like this?
Help me please.
@GWAK
See my code below this one.
It works on KitKat.
Please try on other modes.
Thank you for the answer.
Where can I find your code?
please answer about my question.
Strange!!
import processing.android.CompatUtils;
It’s a processing lib widely used. A lot of android sketches will not work if this import cannot be resolved.
What is your Android version?
@GWAK
Lollipop But this should work on above also.
Please try changing the line:
menubarId=CompatUtils.getUniqueViewId();
and:
menuanchorId=CompatUtils.getUniqueViewId();
to:
menubarId = View.generateViewId();
and:
menuanchorId = View.generateViewId();
And ofcourse not import the CompatUtils lib.
@ noel, @GWAK === i have tested the code from @Noel on 3 phones with lolipop, kitkat && mm and it works; i have also posted another way to make a menu, using toolbar and CompatsUtils: everything runs fine; what is more strange is that your error is not about CompatsUtils but about the processing.android!!! - Now, in some cases i have got this weird error but at the very very beginning of compiling and without consequence: if you are using exactly the code @noel that means that there is something wrong in your install or in P5 itself…
Very Nice!! A sliding menu. Are you willing to share the code?
By the way does that mean that, as you promised in another topic to try the popup menu, it didn’t work on your phone even with the changes I suggested above?
Unfortunately, the menu bar is implemented through a picture image.
The original purpose popup will proceed. I’ll just do it after finishing another project.
Thank you.
boolean MENU_BAR = false;
int MENU_BAR_TIMER = 0; int MENU_BAR_WIDTH = 0;
boolean MENU_BAR_GRAPHIC = false;
void mousePressed(){//----------------------------------------------------------------------------//
// [메뉴바]
if(display_n != 0){
x = int(0.07width); y = int(0.05height); w = int(0.11width); h = int(0.06height);
if ( mouse_setting(x,y,w,h) == true){
if(MENU_BAR == false) { println(“MENUBAR EVNET”); MENU_BAR = true; MENU_BAR_GRAPHIC = true; MENU_BAR_TIMER = millis() + 800; }
}
}
//----------------------------------------------------------------------------//}
void DRAW_MENU_BAR(){
//---------------------------------------------------------------------//
if(MENU_BAR_GRAPHIC){
float Speed_value = 30.0;
MENU_BAR_WIDTH = int((float) (MENU_BAR_TIMER-millis()) / Speed_value);
// println(MENU_BAR_WIDTH);
if( MENU_BAR_WIDTH > 0 ) {
}else{
MENU_BAR_GRAPHIC = false;
MENU_BAR_WIDTH = 0;
}
}
//---------------------------------------------------------------------////---------------------------------------------------------------------//
if(MENU_BAR) {
image(background3,int(((40-MENU_BAR_WIDTH)/40.0)0.3width),int(0.5height),int(0.6width),int(1*height));textSize( int(0.06*width) ); x = int(0.11*width); y = int(0.101*height); textAlign(LEFT); fill(0); if(MENU_BAR_GRAPHIC == false) { text(ID,x,y); } // rectMode(CENTER); fill(255,100,100,100); x = int(0.56*width); y = int(0.026*height); w = int(0.08*width); h = int(0.06*height); // rect(x, y, w, h); if (mousePressed == true) { if( mouse_setting(x,y,w,h )) { // -> 취소 MENU_BAR = false; MENU_BAR_GRAPHIC = false; }} x = int(0.225*width); y = int(0.190*height); w = int(0.35*width); h = int(0.05*height); h2 = int(0.068*height); // rect(x, y, w, h); rect(x, y+h2*1, w, h); rect(x, y+h2*2, w, h); rect(x, y+h2*3, w, h); if (mousePressed == true) { if( mouse_setting(x,y,w,h )) { // -> VALUE VIEW MENU_BAR = false; MENU_BAR_GRAPHIC = false; println(" DISPLAY-1"); display_n = 1;FADE_ACTION(); }} if (mousePressed == true) { if( mouse_setting(x,y+h2*1,w,h )) { // -> VALUE VIEW MENU_BAR = false; MENU_BAR_GRAPHIC = false; println(" DISPLAY-2"); display_n = 2;FADE_ACTION(); }} if (mousePressed == true) { if( mouse_setting(x,y+h2*2,w,h )) { // -> VALUE VIEW MENU_BAR = false; MENU_BAR_GRAPHIC = false; println(" DISPLAY-3"); DRAW3_NUMBER = 99; display_n = 3;FADE_ACTION(); }} if (mousePressed == true) { if( mouse_setting(x,y+h2*3,w,h )) { // -> VALUE VIEW MENU_BAR = false; MENU_BAR_GRAPHIC = false; println(" EXIT"); exit(); }}
}
//---------------------------------------------------------------------//}
Thank you. I took a closer look. Now I understand, you did it in pure P5 code. I did something simular before, for a Menu popup. Sliding and fading with a whole screen image I took before and then switching alternately with a custom menu in the draw () function.
It has a nice professionally look. Great!