2017-01-05 13 views
0

Imを使用してnavigation drawer を入力してください。タイトルの後ろに説明がある項目が必要ですlike this example。ここでナビゲーションドロワー明細の説明を追加

は、XMLの私の項目です:

  <item 
       android:id="@+id/nav_calculate" 
       android:icon="@drawable/ic_info_distance" 
       android:title="@string/title_calculate" /> 

は、私はすべての項目のカスタムレイアウトを設定することはできますか? app:actionLayoutの小文字を使用すると、レイアウトの50%しか変更できません。

(私は外部ライブラリを使用できませんので、xmlの説明を追加する必要があります) ありがとう!

答えて

1

このレイアウトは、カスタムナビゲーションドロワーに使用できます。

<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"> 


     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 
<!--your custom views--> 


     </LinearLayout> 

    </android.support.design.widget.NavigationView> 
+0

xmlを使用すると、仕事は少なくなりますが、感謝します!ソリューションかもしれない –

1

DrawerLayoutと呼ばれるものを使用してください。

DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.left_drawer); 

とレイアウトファイル内navigation_bar_layoutファイルは今引き出しのデザインが含まれています

<android.support.design.widget.NavigationView 
    android:fitsSystemWindows="true" 
    android:layout_gravity="start" 
    android:layout_width="@dimen/drawer_width" 
    android:background="@color/colorPrimaryDark" 
    android:layout_height="match_parent"> 

    <include layout="@layout/navigation_bar_layout" /> 

</android.support.design.widget.NavigationView> 

を追加します。

+0

解決策がありますが、私はすべてを変更し、リストビューとアダプタを作成する必要があります..他に解決策がない場合は... :( –

+0

これを実現するライブラリがあります。としょうかん。 –