我的应用程序中有抽屉,我使用此库:com.mikepenz:materialdrawer
当我制作抽屉时,我有一个箭头,我该如何删除它?如何在抽屉中制作轮廓的圆形图像?
这是我的抽屉代码:
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(activity)
.withHeaderBackground(R.drawable.header)
.addProfiles(
new ProfileDrawerItem().withName(activity.getResources().getString(R.string.nickname))
.withEmail(activity.getResources().getString(R.string.drawer_second_line))
.withIcon(activity.getResources().getDrawable(R.drawable.schooler)))
.build();
Drawer result = new DrawerBuilder()
.withAccountHeader(headerResult)
.withActivity(activity)
.withToolbar(toolbar)
.withTranslucentStatusBar(false)
.withActionBarDrawerToggle(true)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_card).withIcon(FontAwesome.Icon.faw_credit_card).withIdentifier(1),
new PrimaryDrawerItem().withName(R.string.drawer_item_pay).withIcon(FontAwesome.Icon.faw_money),
new PrimaryDrawerItem().withName(R.string.drawer_item_lock).withIcon(FontAwesome.Icon.faw_lock).withIdentifier(2),
new DividerDrawerItem(),
new SecondaryDrawerItem().withName(R.string.drawer_item_journal).withIcon(FontAwesome.Icon.faw_book),
new SecondaryDrawerItem().withName(R.string.drawer_item_homework).withIcon(FontAwesome.Icon.faw_calendar),
new SecondaryDrawerItem().withName(R.string.drawer_item_food).withIcon(FontAwesome.Icon.faw_cutlery),
new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_comment).withIdentifier(1),
new DividerDrawerItem(),
new SecondaryDrawerItem().withName(R.string.drawer_item_friends).withIcon(FontAwesome.Icon.faw_users),
new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
new SecondaryDrawerItem().withName(R.string.drawer_item_help).withIcon(FontAwesome.Icon.faw_question_circle))
.build();
答案 0 :(得分:2)
删除箭头是一项非常简单的任务。只需通过以下方法禁用它:
withSelectionListEnabledForSingleProfile(false)
抽屉将方图像作为Profile
图像。如果要禁用圆形蒙版,可以简单地定义使用的不同蒙版。只是改写风格:
<style name="BezelImageView">
<item name="biv_maskDrawable">@drawable/material_drawer_square_mask</item>
<item name="biv_drawCircularShadow">false</item>
<item name="biv_selectorOnPress">@color/material_drawer_primary</item>
</style>
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/res/values/styles.xml#L28
答案 1 :(得分:0)
您需要获取源代码并将其广告到您的项目中然后去挖掘并找到此抽屉使用的布局并进行修改。
答案 2 :(得分:0)
猫头鹰的回答完全无益。
在构建抽屉标题时,您可以执行的操作是调用withSelectionListEnabled(false),这将完全符合您的要求。
示例代码:
AccountHeader drawerHeader = new AccountHeaderBuilder()
.withActivity(this).withSelectionListEnabled(false)
.withHeaderBackground(R.drawable.drawerheader)
.addProfiles(
new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com")
)
.build();