
我可以在不使用/menu/activity_main_drawer.xml的情况下创建自定义导航抽屉列表.这看起来像我想要的.但我担心应用程序的性能.
我想为默认分频器添加保证金.有没有办法自定义默认导航抽屉分隔线?
那是我的定制分频器.一切都很完美.
这是默认导航抽屉的分隔符,我无法给予任何余量.
style.xml
<style name="Apptheme" parent="theme.AppCompat.light.DarkActionbar"> <!-- Customize your theme here. --> <item name="androID:ListdivIDer">@color/colorAccent</item>...</style>
divIDer_layout.xml
<inset xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:inset@R_403_6823@="60dp" androID:insetRight="8dp" > <shape> <solID androID:color="#c0c0c0" /> </shape></inset>
activity_main_drawer.xml
<?xml version="1.0" enCoding="utf-8"?><menu xmlns:androID="http://schemas.androID.com/apk/res/androID"> <group androID:checkableBehavior="single"> <item androID:ID="@+ID/nav_camera" androID:icon="@drawable/rakipicon" androID:title="import" /> <item androID:ID="@+ID/nav_gallery" androID:icon="@drawable/ic_menu_gallery" androID:title="gallery" /> <item androID:ID="@+ID/nav_slIDeshow" androID:icon="@drawable/ic_menu_slIDeshow" androID:title="SlIDeshow" /> <item androID:ID="@+ID/nav_manage" androID:icon="@drawable/ic_menu_manage" androID:title="Tools" /> </group> <item androID:title="Communicate"> <menu> <item androID:ID="@+ID/nav_share" androID:icon="@drawable/ic_menu_share" androID:title="Share" /> <item androID:ID="@+ID/nav_send" androID:icon="@drawable/ic_menu_send" androID:title="Send" /> </menu> </item></menu>
activity_main.xml中
<androID.support.v4.Widget.DrawerLayout 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: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:divIDer="@drawable/divIDer_layout" app:menu="@menu/activity_main_drawer" /> </androID.support.v4.Widget.DrawerLayout>解决方法 用这个
<androID.support.design.internal.NavigationMenuItemVIEwxmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="match_parent"androID:layout_height="?attr/ListPreferredItemHeightSmall"androID:padding@R_403_6823@="?attr/ListPreferredItempadding@R_403_6823@"androID:paddingRight="?attr/ListPreferredItempaddingRight"androID:foreground="?attr/selectableItemBackground"androID:focusable="true"/>
覆盖ListPreferredItempadding@R_403_6823@属性
<!-- Base application theme. --><style name="Apptheme" parent="theme.AppCompat.light.DarkActionbar"><!-- Customize your theme here. --><item name="colorPrimary">@color/colorPrimary</item><item name="colorPrimaryDark">@color/colorPrimaryDark</item><item name="colorAccent">@color/colorAccent</item><!-- HERE--><item name="ListPreferredItempadding@R_403_6823@">18dp</item></style>
根据需要设置ListPreferredItempadding@R_403_6823@.
总结以上是内存溢出为你收集整理的android – 将边距设置为导航抽屉的默认分隔符全部内容,希望文章能够帮你解决android – 将边距设置为导航抽屉的默认分隔符所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)