There.
Now let's take a look at what shows as action is to do this.
Add the icons which will be displayed for each of the elements of our menu.
To do this click on the draw label new vector as it lets choose a color.
Let it be white
and we type in the search settings and we can select any of these icons.
For example this one click Okay.
And here we change the name to white instead of black.
Since the icon is white.
Next.
Finish and just the same
for the rest of the menu items for both.
We'll pick something up.
Here was.
QUESTION
Let me play.
And be okay again here.
What
and one wide them one like lichen
pitches or all its input dollar money
for example the sign
so all these icons we know of in a draw but fold.
And now we can specify that I can attribute here for settings specify settings respectively
for about where I answer Michael
and monetization and now we can specify here show as action always and I will copy two or three elements
and now if we restore the app
you'll see all the icons are displayed on our panel.
Now we don't have this so-called menu overflow.
These three points and we can immediately click on these icons to go to the desired activity or we can
point to one of them never for example on settings.
And if we now restart.
Let's see what happens.
See settings now appears here and these two icons are displayed immediately on the panel.
And one more parameter or more precisely the value that we can specify for these attribute if room if
there is space in the panel.
And in this case the icon will be displayed on the panel if it has enough space here.
If they are there is not enough space then it will be displayed here.
I think this is clear and we cannot delete this element.
Let's leave about the activity here indicate now to let's restart to check if everything works correctly
for us after changing the code
so we have both menu items displayed in this way in overflow.
But when we click on either of them nothing happens see it that is.
Now you need to implement this functionality and we will do it in our main activity.
We need to override another method for this press control.
All and all options item selected this method click okay and this method is called when you click on
any of the menu items and here for a start we will create an END VARIABLE let's call it I.D. and assign
a value by calling the method of these object menu item get item I.D. That is we get the item that is
selected in the menu.
And now we check which element was click.
If I.D. equals our I.D. that action settings our I.D. our savings.
Then here we create an intent.
Name ID for example open settings
and assign the value new intent
and start our settings activity.
And then we need to return true else
let's copy this code.
And now Eve about item is selected then great intent.
Open about and hear about activity class
and start activity.
Also specify about intent but only we need to create.
And you activity
and after the activity is created everything is displayed correctly.
Well let's now check it around our application once again
so we go to the second activity more precise setting and see activity
and now in the same way too about activity.
Let's make a few more changes open Android manifest and specify the label for sentence and for about
so that you can see in which activity we switch it let it be label settings and here accordingly label
about
let's check
and now we can see that we switch it to settings activity and now to about activity we can also in order
not to click on the back arrow on the phone.
We can place the arrow here on the panel so that when you click on this arrow we return to main activity.
Let's make the closing track here to remove the dash here
and then in our settings activity and about activity we indicate the attribute parent activity to name
and specify main activity to specify the parent activity for our two activities.
And also you need to specify meta data metadata or data Android nay.
Android
support and parent activity.
And then specify Android value.
Main activity and the same.
Copy and paste for activity about and for further in our main activity.
We will specify a launch mode is single top which means that when we return from our child activity
is about and settings to our main activity main activity will not restart.
And now let's go back to the settings activity.
And here we have over right to the button for pressing the back arrow so that it behaves like an hour
button that is moving to the parent's activity.
Police were right there following court action bar to sign these get support action bar and law e.
Action bar is not no
action bar said
display at home as OP enabled and true.
We must also override the on option item settings method here.
Press Control or again and on option item selected
and here again will write the code and I.D. d assign it and get item i d e i d equals Android but r
dot I d not home.
There is such a constant brain start constant in Android.
This is the ideal of that home button are all if so and then write the following code.
Now YouTube's navigate up from same task and these that is this code when you click the home button
returns us to the parent activity.
And the same code.
This one here first port about in about activity 2
and these read and method 2 needs to be done that the same thing should be done in about activated.
So now if we restart the application
go to the settings activity and as you can see the back button arrow button is now displayed but we
have a read in it and now it returns us to the parent activity.
If we click it would click we are returning to our main activity and we have done the same for about
activated.