How to import set of icons into Android Studio project

前端 未结 8 599
花落未央
花落未央 2020-11-28 02:40

I downloaded collection of icons from Android Developers center Each icon in this collection is ordered in forlders according to its resolution: drawable-hdpi, drawable-mdpi

8条回答
  •  生来不讨喜
    2020-11-28 02:52

    Newer versions of Android support vector graphics, which is preferred over PNG icons. Android Studio 2.1.2 (and probably earlier versions) comes with Vector Asset Studio, which will automatically create PNG files for vector graphics that you add.

    The Vector Asset Studio supports importing vector icons from the SDK, as well as your own SVG files.

    This article describes Vector Asset Studio: https://developer.android.com/studio/write/vector-asset-studio.html

    Summary for how to add a vector graphic with PNG files (partially copied from that URL):

    1. In the Project window, select the Android view.
    2. Right-click the res folder and select New > Vector Asset.
    3. The Material Icon radio button should be selected; then click Choose
    4. Select your icon, tweak any settings you need to tweak, and Finish.
    5. Depending on your settings (see article), PNGs are generated during build at the app/build/generated/res/pngs/debug/ folder.

提交回复
热议问题