mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

Remove StickyFooter right and left margin #2270

Closed HosseinArabbeigi closed 6 years ago

HosseinArabbeigi commented 6 years ago

Hi there tanks for amazing library i cant remove the left and right padding or margin on sticky footer

android version : 6 library version : 5.9.4

mikepenz commented 6 years ago

If you want to change the look of an item you have to implement your own CustomDrawerItem

see the FAQ or see the sample for more details

HosseinArabbeigi commented 6 years ago

yes i done this by extending AbstractDrawerItem but still has padding

mikepenz commented 6 years ago

Can you post a screenshot please?

HosseinArabbeigi commented 6 years ago

yes of course

CustomItem : 1

CustomItem layout 2

add to drawer : 3

HosseinArabbeigi commented 6 years ago

CPIView component does not have any padding or margin, i used a simple imageview too, and still has margin

HosseinArabbeigi commented 6 years ago

hi penz did you check my code? is there any thing wrong with that? i will send you result of code

HosseinArabbeigi commented 6 years ago

as you see there is right and left distance near the yellow banner : screen shot 2018-04-17 at 9 46 09 am

mikepenz commented 6 years ago

Can you please use the layout inspector of Android Studio and see where the margin/padding is applied. Perhaps it happens in your item

mikepenz commented 6 years ago

Please report back. :) Close for the time being

Amalip commented 5 years ago

Hi @mikepenz! I have the same question and I have checked with the Layout Inspector and It's applied in material_drawer_sticky_footer, it sets startMargin and endMargin in -2147483648

mikepenz commented 5 years ago

there is padding applied for API 17 for compat reasons, the other padding should be applied for the items https://github.com/mikepenz/MaterialDrawer/blob/develop/library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java#L397

Amalip commented 5 years ago

I did DrawerUIUtils.setDrawerVerticalPadding(drawerMenu.getStickyFooter(), 0); but it didn't work.

It looks like this 54435936_409454206488697_7019092355512795136_n

My custom DrawerItem is

public class FooterDrawerItem extends AbstractDrawerItem<FooterDrawerItem, FooterDrawerItem.ViewHolder> {

    @Override
    public int getLayoutRes() {
        return R.layout.drawer_footer;
    }

    @Override
    public int getType() {
        return 0;
    }

    @Override
    public ViewHolder getViewHolder(View v) {
        return new ViewHolder(v);
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        private TextView txv;

        public ViewHolder(View itemView) {
            super(itemView);

            itemView.setPadding(0,0,0,0);
            itemView.setBackgroundColor(Color.TRANSPARENT);
            txv = itemView.findViewById(R.id.txv);
            txv.setPadding(0,0,0,0);
        }
    }

}