Button margin
Closed this issue · 4 comments
Please, is there a way of adding button margins using your library?.
I tried a solution based on another issue, changing the margin/padding of buttons in my activity code, but no luck.
Edit:
I finally figured out on how to change the margin using code:
for (int i = 0; i < mToogle.getChildCount(); i++) {
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams)((Button)mToogle.getChildAt(i)).getLayoutParams();
p.setMargins(p.leftMargin, p.topMargin, (int)Util.convertDpToPixel(8, AlertaActivity.this), p.rightMargin);
((Button)mToogle.getChildAt(i)).requestLayout();
}
Now the challeng is how to remove the background artifact showed here:
Any help would be appreciated =)
Edit 2:
It's done: create a drawable and set a with @android:color/transparent
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" />
</shape>
and write this peace of code
mToogle.setBackgroundResource(R.drawable.your_awesome_drawable);
Hi Felipe,
Sorry for the delay, I'm glad you figured it out.
On Tue, Jun 28, 2016 at 7:58 AM, Felipe Pedroti Raymundo <
notifications@github.com> wrote:
Edit 2:
It's done: create a drawable and set a with @android
https://github.com/android:color/transparentand write this peace of code
mToogle.setBackgroundResource(R.drawable.your_awesome_drawable);
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#37 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABgS-dbmyZ--3YKgqxcc6M2NKXvSVNuIks5qQQyDgaJpZM4I_bcv
.
No problem. I'm using this lib in a project, and the user's design need the margin between buttons. You have an awesome lib, and I'm thinking in contribute to it, giving the user the possibility to add margin between buttons.
Do you think that is it a hard work?
From: Jose Luis Honorato notifications@github.com
Sent: Tuesday, June 28, 2016 11:58:11 AM
To: jlhonora/multistatetogglebutton
Cc: Felipe Pedroti Raymundo; State change
Subject: Re: [jlhonora/multistatetogglebutton] Button margin (#37)
Hi Felipe,
Sorry for the delay, I'm glad you figured it out.
On Tue, Jun 28, 2016 at 7:58 AM, Felipe Pedroti Raymundo <
notifications@github.com> wrote:
Edit 2:
It's done: create a drawable and set a with @android
https://github.com/android:color/transparentand write this peace of code
mToogle.setBackgroundResource(R.drawable.your_awesome_drawable);
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#37 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABgS-dbmyZ--3YKgqxcc6M2NKXvSVNuIks5qQQyDgaJpZM4I_bcv
.
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHubhttps://github.com//issues/37#issuecomment-229075745, or mute the threadhttps://github.com/notifications/unsubscribe/AFZUlmL2eGlnsR0qjsGPb4377gfU0OUgks5qQTaDgaJpZM4I_bcv.