2016-06-27 31 views
5

Sağdan sola açılan bir Gezinme Çekmecem var, her şey yolunda gidiyor ve hamburger simgesi iyi çalışıyor ve sağ köşede bulunuyor ancak menü simgeleri solda menü öğeleri.Menü öğelerinin sağında yer alan Çekmece menü simgeleri

Menü öğelerinin sağına nasıl taşınır?

ekran Bu benim menu.xml

<?xml version="1.0" encoding="utf-8"?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
    <group android:checkableBehavior="none"> 
     <item 
      android:id="@+id/nav_home" 
      android:icon="@drawable/ic_navigation_home" 
      android:title="@string/nav_menu_home" /> 
     <item 
      android:id="@+id/nav_profile" 
      android:icon="@drawable/ic_menu_profile" 
      android:title="@string/nav_profile" /> 
     <item 
      android:id="@+id/nav_help" 
      android:icon="@drawable/ic_navigation_help" 
      android:title="@string/nav_help" /> 
     <item 
      android:id="@+id/nav_manage" 
      android:icon="@drawable/ic_menu_manage" 
      android:title="@string/nav_manage" /> 
     <item 
      android:id="@+id/nav_logout" 
      android:icon="@drawable/ic_logout" 
      android:title="@string/nav_logout" /> 
    </group> 
    <item android:title="@string/nav_communicate"> 
     <menu> 
      <item 
       android:id="@+id/nav_facebook" 
       android:icon="@drawable/ic_facebookx" 
       android:title="@string/nav_face_page" /> 
      <item 
       android:id="@+id/nav_send" 
       android:icon="@drawable/ic_menu_send" 
       android:title="@string/nav_contact" /> 
     </menu> 
    </item> 
</menu> 

olduğunu

enter image description here

vuruldu bakınız ve bu benim düzen

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 
</android.support.design.widget.AppBarLayout> 
<android.support.v4.widget.DrawerLayout 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 
    <include 
     layout="@layout/app_bar_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_main" 
     app:menu="@menu/activity_main_drawer" /> 
</android.support.v4.widget.DrawerLayout> 
</LinearLayout> 

olduğunu 'çok fazla arandı ama değil mi Bu konuyla ilgili herhangi bir şey bulmuyorum.

Şimdiden teşekkürler.

+0

Fragment ekleme ve reclyerview ile yapmaya çalışın –

+0

@WaqarYounis İpucu için teşekkürler :) – Mohammad

cevap

3

Eğer DrawerLayout tek yolu işlemek için NavigationView kullanmak istiyorsanız o var (şu anda) o özel hale getirmek NavigationView aşağıdaki kodu ile sağdan sola:

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) //call this before super.onCreate 
private void forceRtlIfSupported() { 
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 
     getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); 
    } 
} 

ve AndroidManifiest.xml

RTL bayrağı set
android:supportsRtl="true" 

maalesef bu şekilde yalnızca API 16 ve üzeri için desteklenir. Ancak, DrawerLayout'u ListView ile uygulayabilir ve sonra ne istersen yapabilirsin. Bu yaklaşım hakkında bir here bulabilirsiniz.

+1

Çok teşekkür ederim. Bir deneyeceğim ve size geri döneceğim :) – Mohammad