您的位置:首页 > 移动开发 > Android开发

SVG向下兼容-from动脑学院

2017-06-06 20:47 309 查看
兼容问题,5.0以上的可以直接用:

一、兼容5.0以下的版本

1、使用Android Studio 2.2以上的版本,gradle版本在2.0以上,准备步骤

1.1、添加
defaultConfig {
vectorDrawables.useSupportLibrary = true

}
1.2、添加
compile 'com.android.support:appcompat-v7:25.3.1' //需要是23.2 版本以上的

1.3、Activity需要继承与AppCompatActivity

1.4、布局文件当中添加
xmlns:app="http://schemas.android.com/apk/res-auto"

2、使用在Actvity前面添加一个flag设置

static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

2.1 ImageView/ImageButton
XML app:srcCompat
代码里面使用无区别

2.2 Button 不支持app:srcCompat
Xml 使用在Button的selector

2.3 RadioButton 直接使用

2.4 textview的drawable  直接使用

2.5 使用的动态Vector Drawable
主要是不能直接修改 pathData
不能使用自定义interpolator
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  svg android