I want to add image view on action bar right hand side.I tried to do that but i couldn't. Can anyone help me?
This is my image view xml
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/adnace_search_i" />
This is the image of action bar that i want to create.
try this...
Add this line to the menu.xml in the res/menu/menu.xml
You can see more actionBar property over android developer tutorials
Use
Code for Custom ImageView
Use this layout. I just used that on API 28
You don't need an ImageView for this. Using a new item using Icon for your image will be the smartest solution.
Add this item to your menu.xml:
Instantiate the menu in
onCreateOptionsMenu
and implement it inonOptionsItemSelected
.