HomeSketchwareMenu with icon in actionbar in sketchware

Menu with icon in actionbar in sketchware

1) Create a sketchware project.


2) Add a more block extra. 3) In that more block extra do as below:-


4) Code used in First ASD block is:-
}

@Override

public boolean onCreateOptionsMenu (Menu menu){
menu.add(0,0,0,”Settings”).setIcon(R.drawable.settings) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(0,1,1,”Profile”);
menu.add(0,2,2,”About”);
menu.add(0,3,3,”Rate now”);
return true;

5) Code used in Second ASD block is:-

}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
case 0:
_settings();
break;
case 1:
_profile();
break;
case 2:
_about();
break;
case 3: 
_rate();
break;
}
return super.onOptionsItemSelected(item);

6) Since I added 4 menus there is only 4 cases.


7) Then add a image with name settings.



8) Then add 4 more blocks. In here I am created settingsprofileaboutrate .

That,s all. Save and run project…


Leave a Reply