Skip to content

Latest commit

 

History

History
92 lines (62 loc) · 3.58 KB

SVG_README.md

File metadata and controls

92 lines (62 loc) · 3.58 KB

SelectorInjection

本项目提供了 Android 中按钮的 SVG (vectorDrawable) 支持,可以支持在 Android 5.0 以下使用 SVG 图片和 Tint 着色方案。

依赖方式

1.添加JitPack仓库

repositories {
    maven {
        url "https://jitpack.io"
    }
}

2.添加依赖

implementation 'com.github.tianzhijiexian:SelectorInjection:Latest Latest release (click it)'

属性介绍

原则上是将原本android:前缀变成app:就可以支持 SVG (vectorDrawable) 和 Tint 了,下面是自定义控件和其支持属性的介绍:

SelectorTextView:

app:drawableLeft="@drawable/icon_facebook_svg"  
app:drawableLeftTint="@color/red"

属性格式:

  • drawable(Top/Left/Right/Bottom)
  • drawable(Top/Left/Right/Bottom)Tint

SelectorImageButton:

app:src="@drawable/icon_facebook_svg"
android:tint="@color/orange"

SelectorRadioButton:

app:button="@drawable/icon_renren_svg" 
app:buttonTint="@color/red"

注:对于单选按钮的SVG和Tint支持

示例

View Explain Attribute
SelectorTextView
app:drawableBottom="@drawable/icon_facebook_svg"
app:drawableBottomTint="@color/green"
SelectorImageButton
app:src="@drawable/icon_robot_svg"
android:tint="@color/orange"
SelectorRadioButton
app:button="@drawable/icon_check_selector"
app:buttonTint="@color/orange"

支持自动提示

开发者

Jack Tony: developer_kale@foxmail.com

License

Copyright 2016-2019 Jack Tony

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.