android - Searchview overlaps the other view of the custom action bar -


i have implement custom action bar using appcompat v7 support library. have created custom layout have desired view. have placed searchview in custom layout also.

finally got desired output shown below.enter image description here

problem ::

when click on searchview view overlaps on other view of layout looks ugly.

enter image description here

i want behave searhview blow screen shot..

kindly let me know wrong..

any suggestion/snippet helpful.

customactionbar layout ::

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:yourapp="http://schemas.android.com/apk/res-auto"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_margin="5dp" >      <imageview         android:id="@+id/imgappicon"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="@drawable/ic_launcher" />      <textview         android:id="@+id/txtappname"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centervertical="true"         android:layout_marginleft="10dp"         android:layout_torightof="@+id/imgappicon"         android:text="test app"         android:textsize="16sp"         android:textstyle="bold" />      <imageview         android:id="@+id/imgoverflow"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentright="true"         android:layout_centervertical="true"         android:background="@drawable/icon_overflow" />      <android.support.v7.widget.searchview         android:id="@+id/imgsearchview"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centervertical="true"         android:layout_toleftof="@+id/imgoverflow"         yourapp:actionviewclass="android.support.v7.widget.searchview"         yourapp:iconifiedbydefault="true"         yourapp:showasaction="ifroom|collapseactionview" />  </relativelayout> 

homeactivity.java

    actionbar = getsupportactionbar();  actionbar.removealltabs();  getsupportactionbar().sethomebuttonenabled(true);  getsupportactionbar().setnavigationmode(actionbar.navigation_mode_tabs);  getsupportactionbar().setdisplayoptions(actionbar.display_show_custom);  getsupportactionbar().setcustomview(r.layout.custom_actionbar_home);getsupportactionbar().setdisplayshowcustomenabled(true);   imageview imgoverflowmenu = (imageview) getsupportactionbar().getcustomview().findviewbyid(r.id.imgoverflow); 


Comments