FAB-Loading icon indicating copy to clipboard operation
FAB-Loading copied to clipboard

Vector image got too wide and coming out of Fab

Open SahajRana opened this issue 9 years ago • 2 comments

Hey! thanks for this beautiful library, while I'm using it I get stuck on this thing

Its like this, screenshot_2016-07-06-20-24-31_com rana sahaj myyu

and my xml is

<io.saeid.fabloading.LoadingView android:id="@+id/fab_like" android:visibility="visible" android:layout_marginEnd="6dp" android:layout_gravity="end" android:scaleX="1" android:scaleY="1" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" app:mfl_onclickLoading="true" app:mfl_duration="400" android:elevation="4dp" android:src="@drawable/ic_favorite_outline_24dp" android:layout_alignParentEnd="true"/>

SahajRana avatar Jul 06 '16 14:07 SahajRana

Having the same exact issue when using a VactorDrawable :(.

Abushawish avatar Jun 28 '17 19:06 Abushawish

For now, my fix has been this. In the VectorDrawable's XML, I encapsulate the <path> tag with:

<group
        android:pivotX="50"
        android:pivotY="50"
        android:scaleX="0.3"
        android:scaleY="0.3">

Where pivotX/pivotY is half of the viewportWidth/viewportHeight of the vector (to center) and scaleX/scaleY is how much to scale the image by, change this until image fits as intended.

End result example:


<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="512dp"
        android:height="512dp"
        android:viewportHeight="100.0"
        android:viewportWidth="100.0">
    <group
        android:pivotX="50"
        android:pivotY="50"
        android:scaleX="0.3"
        android:scaleY="0.3">
        <path
            android:fillColor="#FFFFFF"
            android:pathData="M50,40c-8.28,0 -15,6.72 -15,15c0,8.28 6.72,15 15,15c8.28,0 15,-6.72 15,-15C65,46.72 58.28,40 50,40zM90,25H78c-1.65,0 -3.43,-1.28 -3.95,-2.85l-3.1,-9.31C70.43,11.28 68.65,10 67,10H33c-1.65,0 -3.43,1.28 -3.95,2.85l-3.1,9.31C25.43,23.72 23.65,25 22,25H10C4.5,25 0,29.5 0,35v45c0,5.5 4.5,10 10,10h80c5.5,0 10,-4.5 10,-10V35C100,29.5 95.5,25 90,25zM50,80c-13.81,0 -25,-11.19 -25,-25c0,-13.81 11.19,-25 25,-25c13.81,0 25,11.19 25,25C75,68.81 63.81,80 50,80zM86.5,41.99c-1.93,0 -3.5,-1.57 -3.5,-3.5c0,-1.93 1.57,-3.5 3.5,-3.5c1.93,0 3.5,1.57 3.5,3.5C90,40.43 88.43,41.99 86.5,41.99z"/>
    </group>
</vector>

Abushawish avatar Jun 29 '17 09:06 Abushawish