0
I am creating a Profile screen, and would like to put a Options Menu with the options 'Edit Profile' and 'Quit'. The problem is that I don’t have an Action Bar on this screen, and I don’t want to put one, but I would like to create this Options Menu in the upper right corner of the screen. Is that possible? How can I do this?
the XML of this screen is like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/greylight"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="260dp"
android:orientation="vertical"
android:background="@drawable/gradient_background_profile">
<ImageView
android:layout_marginTop="35dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/profile"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Caíque Araujo"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="21sp"/>
<TextView
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Universidade Federal do Ceará"
android:textColor="@color/white"
android:textSize="15sp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
Use a Toolbar, which can be placed anywhere in the code, and you can inflate a menu into it. But the way you want to do it, you can put a transparent actionbar, and make the content appear behind it, or increase the image’s top and bottom padding to the size of the transparent actionbar (56dp)
– Grupo CDS Informática
You can use Pop Menu just follow the description of this post
– Weslley Barbosa