2016-05-11 17 views
1

So entfernen Sie den Platz Mikepenz Material Drawer.I verwendet benutzerdefinierte Layout für Profilmenü und Schublade Elemente. Ich habe für diese Ansichten keine Ränder oder Abstände festgelegt. Und ich versuchte auch Tätigkeit horizontalen Rand zu 0. enter image description here Hilfe würde geschätzt werden. gleicher Rand rechte Seite auch. Profilmenü ist Ok. Es hat kein Problem.Entfernen Sie den linken Rand von MaterialDrawers

Below Code ist das Profil Menü

<?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" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:fitsSystemWindows="true" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="30dp" 
     android:orientation="vertical"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <de.hdodenhof.circleimageview.CircleImageView 
       android:id="@+id/imgUserProfileImage" 
       android:layout_width="40dp" 
       android:layout_height="40dp" 
       android:layout_margin="@dimen/min_margin" 
       android:src="@drawable/parent" /> 

      <com.CustomTextView 

       android:id="@+id/txtUserName" 

       style="@style/label_text_primary" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:padding="10dp" 
       android:text="Noorul" 
       app:font="@string/montserrat_semi_bold" /> 
     </LinearLayout> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="0.3dp" 
      android:layout_marginTop="@dimen/min_margin" 
      android:layout_marginLeft="@dimen/min_margin" 
      android:background="#999999" /> 
    </LinearLayout> 


</LinearLayout> 

und Below-Code ist für Drawer Punkt Menü

<?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" 
    android:id="@+id/lnrSecond_menu" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/material_drawer_item_secondary" 
    android:orientation="horizontal"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent"> 

     <View 
      android:id="@+id/view" 
      android:layout_width="3dp" 
      android:layout_height="match_parent" 
      android:background="@color/primary" 
      android:visibility="gone"/> 

    </LinearLayout> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:gravity="center"> 

     <ImageView 
      android:id="@+id/material_drawer_icon" 
      android:layout_width="@dimen/profile_img" 
      android:layout_height="@dimen/profile_img" 
      android:padding="@dimen/most_most_normal_margin" 
      android:src="@mipmap/ic_launcher" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:gravity="center_vertical|start" 
     android:orientation="vertical"> 

     <com.CustomTextView 
      android:id="@+id/material_drawer_name" 
      style="@style/label_text_secondary" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="center_vertical|start" 
      android:textDirection="anyRtl" 
      android:text="Some Secondary Text" 
      app:font="@string/montserrat_regular" 
      /> 

     <com.CustomTextView 
      android:id="@+id/material_drawer_description" 
      style="@style/label_text_secondary" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:singleLine="true" 
      android:visibility="gone" 
      app:font="@string/montserrat_regular" 
      android:text="Some drawer text" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/material_drawer_badge_container" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:gravity="right|center"> 

     <com.CustomTextView 
      android:id="@+id/txtMenuBadge" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="@dimen/min_margin" 
      android:gravity="center" 
      android:text="99" /> 
    </LinearLayout> 

</LinearLayout> 

Wo ich den Fehler gemacht? Hilf mir, ich werde dir dankbar sein.

+0

Bitte fügen Sie einen Kommentar hinzu, wenn Sie die Frage abgelehnt haben. Weil ich mir Androiden nicht bewusst bin. Ich möchte mich selbst korrigieren. ob diese Frage falsch ist oder nicht. Vielen Dank. – Noorul

+0

Wahrscheinlich down-datiert, weil Sie anfangs keinen Code hatten. Sie könnten negative Ränder versuchen, wenn es 0 Marge zurzeit gibt –

+0

ja ich versuchte das selbe, das Sie sagten. aber der Indikator verbirgt sich, wenn ich versuche, eine negative Marge zu setzen. – Noorul

Antwort

4

Die Schublade fügt dieses padding hinzu, weil es für alle Elemente innerhalb der Material Design Guidelines Standard ist. Da es ein Problem mit der API ist 17 Ich habe dies in dieser Zeile programmatisch setzen: https://github.com/mikepenz/MaterialDrawer/blob/develop/library/src/main/java/com/mikepenz/materialdrawer/model/BasePrimaryDrawerItem.java#L104

Sie könnten auch die DrawerItem s Sie verwenden, wie der Screenshot wie Sie die Standardelemente verwenden, sehen nicht zu stellen.

Wenn Sie bereits Ihre eigenen CustomDrawerItem erstellen, möchten Sie nur die Auffüllung wieder auf 0px setzen (Wenn Sie von der BasePrimaryDrawerItem erweitern) Wenn Sie nicht von ihm aus erstrecken, sollten Sie in Ordnung sein.

Die Schublade legt diese Polsterung nirgendwo anders als hier an.

+0

Vielen Dank. Es hat mir geholfen.. – Noorul

Verwandte Themen