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

Graphic scaling #33

Closed
ToddManUtah opened this issue Aug 16, 2015 · 6 comments
Closed

Graphic scaling #33

ToddManUtah opened this issue Aug 16, 2015 · 6 comments

Comments

@ToddManUtah
Copy link

Does the library support scaling of graphics?

I have a ImageButtton I'm trying to replace. I have it working with ImageButton with the following:

<ImageButton

    android:id="@+id/app_list_refresh_button"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_margin="5dp"
    android:adjustViewBounds="false"
    android:padding="1dp"
    android:scaleType="fitCenter"
    android:src="@drawable/button_refresh"
    android:background="@color/button_material_dark"/>

The image is 256x256 and I'm trying to have the button scale it down to fit into the FancyButton. But, I can't get it to scale down.

   <mehdi.sakout.fancybuttons.FancyButton
        android:id="@+id/app_list_refresh_button"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:padding="5dp"
        fancy:fb_iconResource="@drawable/button_refresh"
        fancy:fb_fontIconSize="25dp"
        fancy:fb_iconPaddingLeft="0dp"
        fancy:fb_iconPaddingRight="0dp"
        fancy:fb_defaultColor="#696969"
        fancy:fb_focusColor="#a9a9a9"
        fancy:fb_radius="5dp"/>
@medyo
Copy link
Owner

medyo commented Aug 18, 2015

what do you mean by scaling it ? having same icon size as button ?

@ToddManUtah
Copy link
Author

I have a graphic that is 150x150. I want the button to be 30x30. The
problem is, that I can't get the graphic to scale within the button. If I
make the graphic 30x30, then it works. If I don't, the button ends up
being huge.

Does that make sense?

Using the standard button, I was able to set the size of the button and
instruct the button to scale the image to fit inside those dimensions. I
can't quite figure out how to make the FancyButton do the same thing.

Todd Lawson
Business: 801-609-8633
Email: todd.c.lawson@gmail.com

On Tue, Aug 18, 2015 at 4:14 AM, Mehdi Sakout notifications@github.com
wrote:

what do you mean by scaling it ? having same icon size as button ?


Reply to this email directly or view it on GitHub
#33 (comment).

@medyo
Copy link
Owner

medyo commented Aug 22, 2015

I think you should define a ScaleType for the fancybutton Image like so myfancybutton. getIconImageObject().setScaleType(ScaleType.X);
Change X by the suitable one : http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

@medyo
Copy link
Owner

medyo commented Sep 26, 2015

@ToddManUtah any update on this ?

@ToddManUtah
Copy link
Author

I just tried it and still no luck. The graphic isn't scaled down. Here's my code:

    refreshButton = (FancyButton) view.findViewById(R.id.app_list_refresh_button);
    refreshButton.getIconImageObject().setScaleType(ImageView.ScaleType.FIT_CENTER);

I also tried several other scale types. All allowed the button to grow beyond the bounds defined for the button. Here is the button xml:

    <mehdi.sakout.fancybuttons.FancyButton
        android:id="@+id/app_list_refresh_button"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:padding="5dp"
        fancy:fb_iconResource="@drawable/button_refresh"
        fancy:fb_fontIconSize="25dp"
        fancy:fb_iconPaddingTop="5dp"
        fancy:fb_iconPaddingBottom="5dp"
        fancy:fb_iconPaddingLeft="5dp"
        fancy:fb_iconPaddingRight="5dp"
        fancy:fb_defaultColor="#696969"
        fancy:fb_focusColor="#a9a9a9"
        fancy:fb_radius="5dp"/>

The graphic I'm using is 150x150.

@medyo
Copy link
Owner

medyo commented Nov 27, 2015

Closing. If you still have the issue please re-open

@medyo medyo closed this as completed Nov 27, 2015
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

2 participants