android-vectordrawable

How to center vector drawable in layer-list without scaling

戏子无情 提交于 2019-12-02 14:34:45
I am attempting to use a VectorDrawable in a LayerList without scaling the vector. For example: <layer-list> <item android:drawable="@color/grid_item_activated"/> <item android:gravity="center" android:drawable="@drawable/ic_check_white_48dp"/> </layer-list> The drawable ic_check_white_48dp id defined as: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FFFFFFFF" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/> </vector> The

How to create vector drawables for android?

对着背影说爱祢 提交于 2019-12-02 13:55:49
I am new to VectorDrawables . I can see that the default vector drawables provided with android studio like ic_menu_gallery , ic_menu_camera , etc. are working great. So I tried to create my own vector drawables by converting my png images to svg first and using the path and fill values to make vector drawables i.e replaced the android:pathData for d and android:fillColor for fill tag in svg files. It somehow gave vector drawables but distorted or currputed looking. If I am not taking the right approach please suggest me. You can use Android Studio. Convert png to svg file online tools PNG to

Convert Android vector drawable to launcher icon PNG

浪尽此生 提交于 2019-12-02 11:23:30
I've made Android launcher icon as vector but I found out that I should use PNGs instead of vector(XML). How can I convert my vector image to PNGs for launcher icon. This is vector if it's of any help: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:width="100dp" android:height="100dp"> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#5FB0C9"/> <size android:width="100dp" android:height="100dp"/> <stroke android:width="5dip" android:color="#3DA8C9"/> <

How to fit VectorDrawable to ImageView and remove unnecessary paddings

守給你的承諾、 提交于 2019-12-02 02:49:20
For my Android app I've created such layer list from two vector Drawable. The xml-code I want to put this image into ImageView, but I have a problem with paddings which I can't remove (marked in red) . To solve this issue I've already applied follow steps: Explicitly set paddings to 0 value Set "AdjustViewBound" to true Played with "fitType" attributes. None of this hadn't been worked for me. Please help me to resolve this problem. You should get a whole drawable with the circle and person in one vector. But if you really need these two files to be separated, you must change the path in the

TransitionDrawable with vector drawables

三世轮回 提交于 2019-12-01 13:46:22
I have TransitionDrawable defined in xml like this: transition.xml <?xml version="1.0" encoding="utf-8"?> <transition xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/ic_disabled" /> <item android:drawable="@drawable/ic_enabled" /> </transition> I use it to animate state changes of checkbox: val stateDrawable = ContextCompat.getDrawable(this, R.drawable.transition) as TransitionDrawable checkbox.buttonDrawable = stateDrawable checkbox.setOnCheckedChangeListener { icon, checked -> if (checked) { stateDrawable.startTransition(300) } else {

TransitionDrawable with vector drawables

烈酒焚心 提交于 2019-12-01 11:26:06
问题 I have TransitionDrawable defined in xml like this: transition.xml <?xml version="1.0" encoding="utf-8"?> <transition xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/ic_disabled" /> <item android:drawable="@drawable/ic_enabled" /> </transition> I use it to animate state changes of checkbox: val stateDrawable = ContextCompat.getDrawable(this, R.drawable.transition) as TransitionDrawable checkbox.buttonDrawable = stateDrawable checkbox

Android: How to change android:fillcolor with selector in one Vector Drawable xml

浪子不回头ぞ 提交于 2019-12-01 04:25:49
Tab Icons: My current method is to create two files (ic_list_selected_24dp.xml and ic_list_unselected_24dp.xml; they are basically the same but only the android:fillColor='Color HEX CODE' are different), and then create a selector (selector_tabitem_list.xml) to change the drawable color when the state is changed. // @drawable/selector_tabitem_list.xml <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:drawable="@drawable/ic_list_selected_24dp" android:state_selected="true" /> <item android:drawable="@drawable

Android studio 1.5.1: Could not find property 'vectorDrawables'

佐手、 提交于 2019-12-01 02:37:27
问题 I'm using Android Studio 1.5.1, Gradle 2.8 and my project min sdk vserion:14, target sdk version: 23. So, When I add vectorDrawables to configuration by documentation Google: Added VectorDrawable support library, I get following error: Error:(13, 0) Could not find property 'vectorDrawables' on ProductFlavor_Decorated{name=main, dimension=null, minSdkVersion=ApiVersionImpl{mApiLevel=14, mCodename='null'}, targetSdkVersion=ApiVersionImpl{mApiLevel=23, mCodename='null'}, renderscriptTargetApi

AnimatedVectorDrawable does not animate

我的梦境 提交于 2019-11-30 23:30:05
问题 I tried to get animated vectorDrawables working and did everything according to http://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html and it still does not work. I also tried to make this project work. https://github.com/chiuki/animated-vector-drawable Does anyone know why it does not animate? Here are the files I used: AnimatedVectorDrawable <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/circle">

Android Vector Drawable <defs> not support. How to fix it?

南楼画角 提交于 2019-11-30 23:21:09
问题 | got this error when try to generate a vector asset from local svg files from AndroidStudio 2.2, Ubuntu 14.04 Could not generate a preview In icon.svg ERROR@ line 6 <defs> is not supported ERROR@ line 25 <use> is not supported Here is the svg icon I google and found that happened because AndroidStudio doesn't support <defs> , <use> ... But I don't know how to fix it? Can I change <defs> to another tag that AndroidStudio support? Or I never can generate vector asset from this SVG file? Any