metalink
metalink

Reputation: 584

Drawer android, remove arrow

I have drawer in my application, and I use this library: com.mikepenz:materialdrawer When I make drawer I have an arrow, how can I remove it? And how can I make circle image of profile in the drawer?

enter image description here
this is it: enter image description here

And this my code of drawer:

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();

Upvotes: 2

Views: 1028

Answers (3)

mikepenz
mikepenz

Reputation: 12868

Removing the arrow is a really simple task. Just disable it via the following method:

withSelectionListEnabledForSingleProfile(false)

https://github.com/mikepenz/MaterialDrawer/blob/develop/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java#L545

The drawer takes square images as Profile images. if you want to disable the circle mask, you can simple define a different mask which is used. Just overwrite the style:

<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

Upvotes: 2

Daniel Almeida
Daniel Almeida

Reputation: 49

Owls' answer is completely unhelpful.

What you can do is call withSelectionListEnabled(false) when building the drawer header, which will do exactly what you want.

Example code:

AccountHeader drawerHeader = new AccountHeaderBuilder()
            .withActivity(this).withSelectionListEnabled(false)
            .withHeaderBackground(R.drawable.drawerheader)
            .addProfiles(
                    new ProfileDrawerItem().withName("Mike Penz").withEmail("[email protected]")
            )
            .build();

Upvotes: 0

A.Sanchez.SD
A.Sanchez.SD

Reputation: 2070

You would need to get the source and ad it to your project then go dig around and find the layouts this drawer is using and modify them.

Upvotes: 0

Related Questions