2016-09-04 8 views
1

私はDrawerLayout上のメニュー項目のカスタムレイアウトを添付しようとしているためカスタムレイアウト上の全幅を設定していますが、ご覧のように、メニュー項目は、全幅を持っていないと私は、この問題Androidのメニュー

に解決することはできませんcreate_new

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center_vertical" 
       android:paddingTop="5dp" 
       android:paddingBottom="5dp"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="25dp" 
     android:text="New Text" 
     android:gravity="left|center" 
     android:layout_marginLeft="20dp" 
     android:background="#000" 
     android:textColor="#fff"/> 
</LinearLayout> 
として enter image description here

マイメニューレイアウト

<?xml version="1.0" encoding="utf-8"?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto"> 
    <group android:id="@+id/groupOne"> 
     <item 
      android:id="@+id/inbox" 
      app:actionLayout="@layout/create_new"/> 
    </group> 
</menu> 

とそのための私のカスタムレイアウト

+0

これで運がいいですか? –

答えて

0

ええ、私のために働いた唯一の方法は、カスタムレイアウトのルートビューにandroid:layout_width="100000dp"を設定することでした。

しかし、醜い醜いハック。

関連する問題