如何删除空间Mikepenz Material Drawer。我对配置文件菜单和抽屉项目使用了自定义布局。我没有为这些视图设置边距或填充。我也尝试将活动水平边距设置为0。我们将不胜感激。同样边距右边也。个人资料菜单还可以。它没有问题。而抽屉项目正面临这个问题。
下面的代码是配置文件菜单
<?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>
以下代码用于抽屉项目菜单
<?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>
我在哪里犯了错误?帮帮我,我将感谢你们。
抽屉中添加了此内容,padding
因为它是内所有项目的默认设置Material Design Guidelines
。由于API 17存在问题,因此我必须在以下这一行中以编程方式进行设置:https : //github.com/mikepenz/MaterialDrawer/blob/develop/library/src/main/java/com/mikepenz/materialdrawer/model/ BasePrimaryDrawerItem.java#L104
您可能还想发布DrawerItem
您使用的,因为屏幕截图看起来并不像您使用的默认项目。
如果您已经创建了自己CustomDrawerItem
的填充,则只想再次将padding设置为0px(如果从扩展BasePrimaryDrawerItem
),如果没有从其扩展,就可以了。
抽屉不在此处以外的其他任何地方设置此填充。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句