Android中VectorDrawableCompat的使用注意事项
来源:互联网 发布:淘宝卖家如何上传宝贝 编辑:程序博客网 时间:2024/06/10 07:31
- 首先在APP的Gradle配置文件中加入如下配置:
在Gradle2.0:android { defaultConfig { vectorDrawables.useSupportLibrary = true }}在Gradle1.5中:android { defaultConfig { // Stops the Gradle plugin’s automatic rasterization of vectors generatedDensities = [] } // Flag to tell aapt to keep the attribute ids around aaptOptions { additionalParameters "--no-version-vectors" }}
- 在AppCompatImageView或者ImageView中使用时需如下使用:
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/ic_search"/>或者ImageView iv = (ImageView) findViewById(...);iv.setImageResource(R.drawable.ic_search);
- 在使用的Activity中,添加如下的配置:
static{AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);}
- SVG的导入
使用插件Vector Asset导入,导入后,位置在Drawable下面,文件实例如下:<vector xmlns:android="..." android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0" android:tint="?attr/colorControlNormal"> <path android:pathData="..." android:fillColor="@android:color/white"/></vector>
0 0
- Android中VectorDrawableCompat的使用注意事项
- android开发中PreferenceScreen的使用注意事项
- Android开发中动画使用的注意事项
- 在导入com.android.support:design时的常见错误Please configure your build for VectorDrawableCompat
- Android中statfs使用注意事项
- Android Sqlite使用中注意事项
- Android中ArrayList的使用注意事项以及效率的比较
- Android中关于线程使用的几点注意事项
- Android Service在测试工程中使用的注意事项
- Android中关于线程使用的几点注意事项
- Android中include标签的使用及注意事项
- 【笔记】关于android中shape使用的注意事项
- Android中CursorLoader的使用、原理及注意事项
- Android中include标签的使用及注意事项
- Android中include标签的使用及注意事项
- Android——ListView中getChildAt(index)的使用注意事项
- android 使用单元测试的注意事项
- Android layout_below使用的注意事项!
- 如何设置mysql innodb 表的压缩
- clang/gcc 链接数学库
- JNDI全攻略(一)
- Appium 在 webview中找不到页面的问题解决
- spring ioc原理(看完后大家可以自己写一个spring)
- Android中VectorDrawableCompat的使用注意事项
- Java与数据库数据类型对应表
- JS字符串操作
- Shell基础1
- 读完这个我懂了JNDI
- javascript:history.go()和History.back()的区别
- springmvc整合mybatis框架源码 bootstrap html5 mysql oracle maven SSM
- centos6.5克隆机器后更改IP地址
- ios新建target出包流程