To create a custom toolbar, we will create new xml layout and put some resource to make it look like toolbar so we can use LinearLayout or RelativeLayout. But I will use LinearLayout to Wrap RelativeLayout, for relative layout we can Image(X ImageView) and Title (TextView) to the left side of its parent and then we create another RelativeLayout with a child of ImageView to make a float to the right side.
2. We create Activity and xml layout by right click on java folder and like below. It will create a class activity and xml layout.
Activity Layout
MainActivity
When you click on X button on left, it shows Toast popup so you can do anything you want like to finish() to close activity.....
When you click on the OverFlowMenu (Dot Image) I will call the popup that has 3 Items in it.
If you use click item one, it will show toast popup for a second... Now let's see how to handle the code this popup.
Another important is another class that I use it for handling popup, it called PopupMenu.class
Here is the popup item:
Here is the popup_item.xml:
If you want to make your popup look like mine, you can add these file to your drawable folder:
File bg_item.xml file:
File shape.xml filel :
File text_color.xml file :
2. We create Activity and xml layout by right click on java folder and like below. It will create a class activity and xml layout.
Activity Layout
MainActivity
When you click on X button on left, it shows Toast popup so you can do anything you want like to finish() to close activity.....
When you click on the OverFlowMenu (Dot Image) I will call the popup that has 3 Items in it.
If you use click item one, it will show toast popup for a second... Now let's see how to handle the code this popup.
Another important is another class that I use it for handling popup, it called PopupMenu.class
Here is the popup item:
Here is the popup_item.xml:
If you want to make your popup look like mine, you can add these file to your drawable folder:
File bg_item.xml file:
File shape.xml filel :
File text_color.xml file :
No comments:
Post a Comment