android - How do I position menu items in ActionBar? -


my actionbar consists of logo , text. done inflating following menu:

<menu xmlns:android="http://schemas.android.com/apk/res/android"     tools:context="com.example.sv_laptop.myapp.register">     <item android:id="@+id/action_settings"         android:title="@string/signup"         android:orderincategory="1"         app:showasaction="always" />      <item android:id="@+id/icon"         android:title="icon"         android:icon="@drawable/icon"         android:orderincategory="0"         app:showasaction="always" /> </menu> 

however, shows both items on far right hand side of actionbar together. want achieve logo being on far left hand side , text/title being in middle.

does know how can this? problem displays image small - highly appreciate if give me walkthrough on how scale it.

this how i'm inflating menu

public boolean oncreateoptionsmenu(menu menu) {     menuinflater mi = getmenuinflater();     mi.inflate(r.menu.menu_register_name, menu);     return true; } 

highly grateful help!

edit:

action_bar_layout

<imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@drawable/icon"/>      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="sign up"/> 

the problem logo displays in center , text displays on far right. when give paddingright logo (imageview) text disappears, move right. if add paddingright text disappears again. have tried setting paddingright in linearlayout , same thing happens.

the behavior getting default behavior of android, looking default behavior of ios.

if want achieve that, have implement custom xml.

getsupportactionbar().setdisplayoptions(actionbar.display_show_custom);  getsupportactionbar().setcustomview(r.layout.actionbar); 

here need create actionbar.xml in layout , inflate it.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -