android - Custom action bar is overlapping other elements -


i trying implement custom action bar in activity. have done below, getting custom action bar overlapped another. have attached screen shot below.

public class mainactivity extends actionbaractivity {       private textview actionbartitle;      @override      protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);          setcontentview(r.layout.main);           actionbar actionbar = getsupportactionbar();            view customview=getlayoutinflater().inflate(r.layout.actionbar_layout, null);         actionbar.setcustomview(customview);           actionbartitle =(textview)findviewbyid(r.id.actionbar_text);         actionbartitle.settext("action bar");       }  } 

manifest:

     <application        android:name="myapplication"        android:allowbackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@style/appbasetheme"        android:requiredforallusers="false">                   <activity android:name="mainactivity"                    android:screenorientation="portrait"/>     </application> 

actionbar_layout.xml

  <?xml version="1.0" encoding="utf-8"?>     <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         android:layout_width="fill_parent"         android:layout_height="wrap_content"          android:background="#ffffff"         android:orientation="vertical" >          <imageview             android:id="@+id/actionbar_icon"             android:layout_width="wrap_content"             android:layout_height="32dp"              android:layout_alignparenttop="true"             android:src="@drawable/ic_launcher" />          <textview             android:id="@+id/actionbar_text"             android:layout_width="wrap_content"             android:layout_height="wrap_content"              android:layout_margintop="8dp"             android:layout_torightof="@+id/actionbar_icon"             android:text="title" />      </relativelayout> 

strings.xml:

<resources>      <string name="app_name">sample</string> </resources> 

styles.xml

 <resources>          <!--             base application theme, dependent on api level. theme replaced             appbasetheme res/values-vxx/styles.xml on newer devices.         -->         <style name="appbasetheme" parent="theme.appcompat.light">             <!--                 theme customizations available in newer api levels can go in                 res/values-vxx/styles.xml, while customizations related                 backward-compatibility can go here.             -->         </style>          <!-- application theme. -->         <style name="apptheme" parent="appbasetheme">             <!-- customizations not specific particular api-level can go here. -->         </style>      <style name="dialog_no_border">             <item name="android:windowisfloating">true</item>             <item name="android:windowbackground">@color/transparent_color</item>         </style>      </resources> 

how can remove sample text , black background custom view displayed?

enter image description here

what showing in screenshot specification says supposed happen. when use custom view in action bar, placed in between app icon (if any) on left side of action bar , action buttons (if any) on right side of action bar.

custom navigation views appear between application icon , action buttons , may use space available there.

actionbar#setcustomview(view view)


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -