eluleci / FlatUI

Android FlatUI Kit
1.66k stars 422 forks source link

Cannot add padding to FlatButton. #17

Closed jstefanowski closed 10 years ago

jstefanowski commented 10 years ago

Hi, I have noticed that all padding settings set in xml layout for FlatButton are ignored (tested on Galaxy Nexus and Galaxy Tab 3 10). It is happening because custom paddings are overriden by paddings added to background drawables ( which is (0, 0, 0, bottom)). I have solution for that (sorry that I haven't done that by pull request). At the beginning of init() method you should save FlatButton paddings and apply them when background drawable is set:

private void init(AttributeSet attrs) {     
        final int paddingTop = getPaddingTop();
        final int paddingRight = getPaddingRight();
        final int paddingLeft = getPaddingLeft();
        final int paddingBottom = getPaddingBottom();
        ...

        setBackgroundDrawable(states);
        setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
        ...
    }
GAV-516 commented 10 years ago

I had the same issue, thanks @jstefanowski for solution!

eluleci commented 10 years ago

fixed with version 2.0.4. thanks @jstefanowski for solution