android - Action items appear to the left of the action bar -


running app custom actionbar , 2 action bar items, displayed differently on different devices. on 1 device, items appear left of action bar logo , on other device action items appear right.

action bar view:

 <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="match_parent"   android:layout_height="match_parent"   android:background="@drawable/background"   android:focusable="true">  <imageview     android:id="@+id/btn_slide"     android:layout_height="wrap_content"     android:layout_width="wrap_content"     android:background="@null"     android:scaletype="centerinside"     android:src="@drawable/logo_advanced"     android:layout_alignparenttop="true"     android:layout_centerhorizontal="true"/> </relativelayout> 

action bar items:

  <?xml version="1.0" encoding="utf-8"?>  <menu xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:compat="http://schemas.android.com/apk/res-auto">  <!-- logout action --> <item android:id="@+id/action_logout"     android:icon="@drawable/logo1"     android:title="logout"     android:showasaction="never"     compat:showasaction="never"     />  <!-- go position--> <item android:id="@+id/action_search_position"     android:icon="@drawable/position_a"     android:title="search_position"     android:showasaction="always"     compat:showasaction="always"     /> 

activity callback:

 @override public boolean oncreateoptionsmenu(menu menu) {      // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main_activity_actions, menu);     return super.oncreateoptionsmenu(menu); } 

dynamically action bar initialization in oncreate of main activity extends activity:

        actionbar actionbar=getactionbar();         view mactionbarview = getlayoutinflater().inflate(r.layout.action_bar, null);         actionbar.setcustomview(mactionbarview);         actionbar.setdisplayoptions(actionbar.display_show_custom); 
  • the device on action items left of action bar logo galaxy 2 (old device build in overflow menu button). on device whatsapp , youtube apps appeared (in opposed newer devices proper appearance), on other hand, other apps tinder , gmail keeps same appearance on devices.

any idea why?

try use toolbar instead of action bar? recommended way of adding action bars.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -