Giter Site home page Giter Site logo

viewsupport's Introduction

ViewSupport

License

该开源库的主要作用就是简化自定义View过程中的一些流程,让自定义View更简单,更方便,更高效,例如:

  • 继承 CustomView 以自动获取 View 大小以及默认画笔。
  • 使用 CanvasAidUtils 绘制当前坐标系以检查绘制的位置。
  • 使用 MathUtils 方便的进行角度弧度转换,计算距离。

除此之外,它还有更多的工具和辅助类来帮助你更方便的自定义View,更多信息请查看下面表格。

如果你对此有什么比较好的建议,欢迎提交 Issues 来告诉我。

对自定义View感兴趣的欢迎来 我的博客 查看相关文章。


工具列表

PS: 点击工具名称查看源码,点击Wiki查看简介。

工具 Wiki 简介
CustomView 查看 自定义View基类,帮助你节省部分代码
CanvasAidUtils 查看 Canvas辅助工具,你可以用它绘制坐标系来帮助你检查视图的位置,并在完成之后移除该坐标系。
CanvasUtils 查看 Canvas绘图工具,封装了一些Canvas没有提供的方法,目前只能用来画一条线。
DensityUtils 查看 密度工具, 根据设备进行如下单位转换: sp -> px, px -> sp, dp -> px, px -> dp
MathUtils 查看 数学工具, 封装一些数学算法,例如: 获取两点之间的距离,获取线段上某一点的位置, 获取线段与水平线夹角 等
ViewUtils 查看 视图工具, 封装了一些与视图相关等内容,如 手动测量视图大小, 为视图动态设置margin 等
ApiHelper 查看 版本检查工具,里面定义了很多与版本相关的常量,并且开放了几个检查方法,检查一个类(class)是否拥有某个字段或者某个方法。
MotionEventHelper 查看 MotionEvent 辅助类,帮助转换 MotionEvent 中的坐标系。

文档

示例

点击此处下载 Sample

如何添加该开源库

Gradle:

Step 1. 添加JitPack仓库

在当前项目等根目录下的 build.gradle 文件中添加如下内容:

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

Step 2. 添加项目依赖

dependencies {
        compile 'com.github.GcsSloop:ViewSupport:v1.3.0'
}

About Me

微博: @GcsSloop

License

Copyright (c) 2016 GcsSloop

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.

viewsupport's People

Contributors

gcssloop avatar

Watchers

James Cloos avatar Vincent Huang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.