Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where fontIcon and button text are not center aligned when button width is match_parent #26

Merged
merged 1 commit into from
Jun 22, 2015

Conversation

squeeish
Copy link

My original problem:

<mehdi.sakout.fancybuttons.FancyButton
                android:id="@+id/buttonChangePassword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingBottom="10dp"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:paddingTop="10dp"
                android:layout_marginBottom="25dp"
                fancy:fb_defaultColor="#FF574E"
                fancy:fb_radius="3dp"
                fancy:fb_text="@string/changePassword"
                fancy:fb_textColor="#FFFFFF"
                fancy:fb_textFont="cg_regular.ttf"
                fancy:fb_fontIconResource="&#xf084;"
                fancy:fb_iconPosition="left"
                />

Setting the layout_width to wrap_content works fine, but match_parent will align the icon to the left and the text to the right of the button.

EDIT: Add screenshot of the button as I see it. Ideally the text + icon should be centered in the button.

Imgur

EDIT2: If fb_iconPosition is top or bottom, text gravity works fine. If fb_iconPosition is right, text gravity defaults to left.

@medyo
Copy link
Owner

medyo commented Jun 20, 2015

It looks perfect, i'll merge it after doing some tests

@squeeish
Copy link
Author

That's great, thanks!

medyo added a commit that referenced this pull request Jun 22, 2015
Fixed issue where fontIcon and button text are not center aligned when button width is match_parent
@medyo medyo merged commit da99276 into medyo:master Jun 22, 2015
@squeeish squeeish deleted the Fix_Issue_With_Match_Parent branch June 25, 2015 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants