ShapeView

by xwc520

xwc520 / ShapeView

可将View剪裁出不同形状,并且可像Shape一样使用

211 Stars 34 Forks Last release: over 2 years ago (1.2.2) Apache License 2.0 75 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

ShapeView

可为你的View剪裁不同形状

Apache 2.0 License

APK文件

扫描二维码 或者 点击二维码 下载

ShapeView

Gradle

compile 'com.github.xwc:ShapeView:1.2.8'
annotationProcessor 'com.github.xwc:ShapeView-compiler:1.2.5'

preview

使用

  • ShapeView ```xml

    <!-- content -->

``` - ButtonShapeView

  

    <!-- content -->

</com.github.xwc.view.buttonshapeview>

公共属性

属性名

说明 默认值
shapeborderColor 边框颜色 red
shapeborderDashGap 边框间隙 0
shapeborderWidth 边框宽度 0
shapedefaultBgd 背景图
shapepressedBgd 按下时背景图
shapedefaultColor 背景色
shape_pressedColor 按下时背景

ButtonShapeView

属性名

说明 默认值
shaperoundRectradius 圆角 0
shaperoundRectbottomLeftRadius 左边底部圆角 0
shaperoundRectbottomRightRadius 右边底部圆角 0
shaperoundRecttopLeftRadius 左边上方圆角 0
shaperoundRecttopRightRadius 右边上分圆角 0

ShapeView

三角形

属性名

说明 范围
shapetrianglepercentLeft 左边顶点起始位置 0~1(float)
shapetrianglepercentBottom 下边顶点起始位置 0~1(float)
shapetrianglepercentRight 右边顶点起始位置 0~1(float)

心形

属性名

说明 范围
shapeheartradian 弧度 0~1(float)
shapeheartYPercent 中间点位置 0~1(float)

多边形

属性名

说明 默认值
shapepolygonside 边数 4
shapepolygonturn 中心点旋转角度 0 (0.5为90°)

对角线

属性名

说明 默认值
shapediagonaldirection 对角起点 left
shapediagonalposition 对角位置 0 (0.5为90°)

历史版本

v1.2.7 更新业务逻辑

v1.2.4 修复圆角度数过大问题    

v1.2.2 支持默认颜色和点击时Color,支持默认背景图和点击时背景图

v1.2.1 支持url加载图片

License

Copyright 2018 xwc

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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.