兼容问题,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