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

If I call "setIconResource" method to a button created by LayoutInflater, all layout information removed. #61

Open
jongidal opened this issue May 10, 2016 · 4 comments

Comments

@jongidal
Copy link

This is a screenshot captured before I call "setIconResouce" method.
device-2016-05-10-143605

The layout of the button is borken.
screenshot_20160510-143433

@medyo
Copy link
Owner

medyo commented May 12, 2016

It's seems there is a bug somewhere, could you share with us your code

@brkckr
Copy link

brkckr commented Jun 20, 2016

Same problem applies to me. I'm using the FancyButton as the row of Recyclerview. And recyclerview has the GridLayoutManager and custom adapter. After adding below lines to adapter, the button which has iconResource as string, ruins the layout's harmony.

button.setIconResource("►");
button.setIconPosition(FancyButton.POSITION_LEFT);
button.setFontIconSize(20);

@medyo
Copy link
Owner

medyo commented Jun 23, 2016

@brkckr could you share a demo project or a snippet so I could check the issue.

@brkckr
Copy link

brkckr commented Jun 25, 2016

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:fancy="http://schemas.android.com/apk/res-auto"
    android:weightSum="6"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="0dp">

        <mehdi.sakout.fancybuttons.FancyButton
            android:id="@+id/btn_spotify1"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            fancy:fb_borderColor="#FFFFFF"
            fancy:fb_borderWidth="1dp"
            fancy:fb_defaultColor="#7ab800"
            fancy:fb_focusColor="#9bd823"
            fancy:fb_fontIconResource="&#xf04b;"
            fancy:fb_iconPosition="left"
            fancy:fb_radius="30dp"
            fancy:fb_text="SHUFFLE PLAY"
            fancy:fb_textColor="#FFFFFF" />

        <mehdi.sakout.fancybuttons.FancyButton
            android:id="@+id/btn_spotify2"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            fancy:fb_borderColor="#FFFFFF"
            fancy:fb_borderWidth="1dp"
            fancy:fb_defaultColor="#7ab800"
            fancy:fb_focusColor="#9bd823"
            fancy:fb_fontIconResource="&#xf04b;"
            fancy:fb_iconPosition="left"
            fancy:fb_radius="30dp"
            fancy:fb_text="SHUFFLE PLAY"
            fancy:fb_textColor="#FFFFFF" />

        <mehdi.sakout.fancybuttons.FancyButton
            android:id="@+id/btn_spotify3"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            fancy:fb_borderColor="#FFFFFF"
            fancy:fb_borderWidth="1dp"
            fancy:fb_defaultColor="#7ab800"
            fancy:fb_focusColor="#9bd823"
            fancy:fb_fontIconResource="&#xf04b;"
            fancy:fb_iconPosition="left"
            fancy:fb_radius="30dp"
            fancy:fb_text="SHUFFLE PLAY"
            fancy:fb_textColor="#FFFFFF" />

        <mehdi.sakout.fancybuttons.FancyButton
            android:id="@+id/btn_spotify4"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            fancy:fb_borderColor="#FFFFFF"
            fancy:fb_borderWidth="1dp"
            fancy:fb_defaultColor="#7ab800"
            fancy:fb_focusColor="#9bd823"
            fancy:fb_fontIconResource="&#xf04b;"
            fancy:fb_iconPosition="left"
            fancy:fb_radius="30dp"
            fancy:fb_text="SHUFFLE PLAY"
            fancy:fb_textColor="#FFFFFF" />

        <mehdi.sakout.fancybuttons.FancyButton
            android:id="@+id/btn_spotify5"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            fancy:fb_borderColor="#FFFFFF"
            fancy:fb_borderWidth="1dp"
            fancy:fb_defaultColor="#7ab800"
            fancy:fb_focusColor="#9bd823"
            fancy:fb_radius="30dp"
            fancy:fb_text="SHUFFLE PLAY"
            fancy:fb_textColor="#FFFFFF" />

    </LinearLayout>

</LinearLayout>

        FancyButton button5 = (FancyButton) findViewById(R.id.btn_spotify5);
        button5.setIconResource("►");
        button5.setIconPosition(FancyButton.POSITION_LEFT);

It works like a champ when you set "IconResource" in xml side. But if you change it by programmatically, it ruins layout's harmony. Check the below images please. In addition, thank you for such a super library. @medyo
seemsbug
okay

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

No branches or pull requests

3 participants