Giter Site home page Giter Site logo

Comments (2)

Abushawish avatar Abushawish commented on July 24, 2024

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

from fab-loading.

Abushawish avatar Abushawish commented on July 24, 2024

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>

from fab-loading.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.