草庐IT

vectorDrawables

全部标签

安卓工作室 1.5.1 : Could not find property 'vectorDrawables'

我正在使用AndroidStudio1.5.1、Gradle2.8和我的项目minsdkvserion:14,目标sdk版本:23。因此,当我通过Google文档将vectorDrawables添加到配置时:AddedVectorDrawablesupportlibrary,我收到以下错误:Error:(13,0)Couldnotfindproperty'vectorDrawables'onProductFlavor_Decorated{name=main,dimension=null,minSdkVersion=ApiVersionImpl{mApiLevel=14,mCodenam

android - 从字符串(路径)创建 VectorDrawable?

有没有办法从API获取SVG路径字符串并动态创建VectorDrawable?我已经尝试了几个小时但没有成功。此外,Internet上的所有(!)示例都解释了从XML资源创建VectorDrawable。在我的例子中,XML资源文件毫无意义,因为我正试图从InternetAPI获取SVG路径。 最佳答案 从XML文件而不是资源中扩展可绘制对象实际上是不可能的,因为可绘制对象会尝试将XmlPullParser转换为XmlResourceParser,这仅由私有(private)类实现XmlBlock.Parser。即使那个解析器也只用

Android Layer-List VectorDrawable大小

我的问题与此有关:link.我最近将我的大部分Android资源从不同分辨率的不同png文件更改为矢量可绘制对象。我正在使用"swipe-to-delete"library可以在滑动期间更改其View的背景,以显示带有垃圾桶图标的Gmail风格的红色背景,类似于此(具有带有复选图标的绿色背景):我曾经使用以下代码来做到这一点,现在我仍然为但是,API21+需要不同的语法现在,API21和API22(Lollipop)上的图标不再是左侧/右侧的图标,而是被拉伸(stretch)以填满屏幕。有没有办法指定图标的宽度? 最佳答案 将此添加

android - VectorDrawable 图像变得像素化

我使用了一些图像,它们是通过本地SVG文件使用AndroidStudio的VectorAssetStudio导入的。图像在我的nexus6p上完美加载,然而,在SonyXperiaZ上,它的像素化非常严重,而在SamsungGalaxys2上,它甚至更糟。据我了解,由于该文件是一个xml(矢量)文件而不是png文件,它应该能够自动调整大小或者我错过了什么。我附上了这3个案例的图片。编辑:只是一些额外的信息:文件最初是PNG,但是,我已经使用名为VectorMagic的程序完全转换为矢量文件。我可以在Illustrator上打开它并编辑每一行等。解决通过VectorDrawableCom

Android vectorDrawables.useSupportLibrary = true 正在停止应用

如果我在gradle中使用vectorDrawables.useSupportLibrary=true然后运行它不幸停止的应用程序。如果我删除vectorDrawables.useSupportLibrary=true应用程序可以工作。我的毕业生:applyplugin:'com.android.application'android{compileSdkVersion25buildToolsVersion"25.0.2"defaultConfig{vectorDrawables.useSupportLibrary=trueapplicationId"com.helikanon.fir

Android vectorDrawables.useSupportLibrary = true 正在停止应用

如果我在gradle中使用vectorDrawables.useSupportLibrary=true然后运行它不幸停止的应用程序。如果我删除vectorDrawables.useSupportLibrary=true应用程序可以工作。我的毕业生:applyplugin:'com.android.application'android{compileSdkVersion25buildToolsVersion"25.0.2"defaultConfig{vectorDrawables.useSupportLibrary=trueapplicationId"com.helikanon.fir

android - 如何从 Illustrator(或类似工具)创建 Android VectorDrawables?

如果我在Illustrator之类的程序中有矢量图像,我怎样才能得到正确的格式供Android的VectorDrawable框架使用?我找到了一个将SVG转换为VectorDrawablexml格式的工具:http://inloop.github.io/svg2android/但它要求SVG只使用“路径”。任何想法如何输出这样的文件? 最佳答案 如果您使用的是AndroidStudio,最好的方法是:右键单击“可绘制”文件夹>新建>矢量资源点击“本地SVG文件”以导入您自己的SVG文件,或点击“Material图标”以使用提供的图标

android - 如何从 Illustrator(或类似工具)创建 Android VectorDrawables?

如果我在Illustrator之类的程序中有矢量图像,我怎样才能得到正确的格式供Android的VectorDrawable框架使用?我找到了一个将SVG转换为VectorDrawablexml格式的工具:http://inloop.github.io/svg2android/但它要求SVG只使用“路径”。任何想法如何输出这样的文件? 最佳答案 如果您使用的是AndroidStudio,最好的方法是:右键单击“可绘制”文件夹>新建>矢量资源点击“本地SVG文件”以导入您自己的SVG文件,或点击“Material图标”以使用提供的图标

android - 在 API 21+ 上使用带有 srcCompat 的 VectorDrawables 将 Android 支持库更新到 23.2.0

很高兴Lollipop之前的设备现在可以通过支持库23.2.0使用VectorDrawables。虽然我在API21+上有图像显示问题,但在低端设备上一切正常。我使用的是GradlePlugin1.5,所以我的build.gradle包含://GradlePlugin1.5android{defaultConfig{generatedDensities=[]}//Thisishandledforyoubythe2.0+GradlePluginaaptOptions{additionalParameters"--no-version-vectors"}}然后我在我的布局中使用下一个代码:

android - FloatingActionButton + VectorDrawable 在 pre-Lollipop 上崩溃

经过一番研究后,我注意到com.android.support:design:23.3.0的FloatingActionButton在android:src上使用SVG时会崩溃。SVG是从AndroidStudioAssets中获取的。它在AndroidSVG:ic_keyboard_voice_white_24dpXML:Gradle:defaultConfig{...vectorDrawables.useSupportLibrary=true}堆栈跟踪:https://gist.github.com/ppamorim/420dba3e9dc3022a86a3a1f50400d7d0