Download the New LearnVern Android App and enter Lucky Draw to win Free Certificate
Here is this video tutorial we will learn about Actionbar and How to use Actionbar in Androidbar in detail.
First, we will create an Actionbar in Android, in this we will use menu.
we will see its manifest file 'AndroidManifest.xml' which is default created.
After that we want to design our project's layout so we will open 'activity_main.xml' file, in which we have simply used relative layout and set some basic properties, and after that we have taken one TextView whose basic properties we have selected.
Now we will design menu for action bar, so for that we will open 'menu_main.xml', now we will set items for menu,
Similarly we have designed 'reset', 'about', and 'exit'.
Now we will see that how how main file works, so for that inside our 'java' folder, we have created another folder 'actionbar', in which we have 'MainActivity.java' file, we'll open it, and see the default generated code.
Now we have to design a code to display actionbar,
public boolean onOptionsItemSelected(MenuItem item)
count.setText(""Add is clicked"");
count.setText(""Nothing is selected"");
Toast.makeText(this, R.string.about_toast, Toast.LEMON_LONG.show();
Now we will execute our code, the actionbar which we designed is accurately created and our whole project is running successfully.
Have a friend to whom you would want to share this course?