

GitHub - HpWens/MeiWidgetView: 一款汇总了郭霖,鸿洋,以及自己平时收集的自定义控...
source link: https://github.com/HpWens/MeiWidgetView
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
MeiWidgetView
MeiWidgetView
一款汇总了郭霖,鸿洋,以及自己平时收集的自定义控件的集合库。主旨帮助大家学习自定义控件中的一些技巧,分析问题解决问题的一种思路。
引入
Step 1. Add the JitPack repository to your build file
root gradle
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Step 2. Add the dependency
app gradle
dependencies {
implementation 'com.github.HpWens:MeiWidgetView:v0.0.3'
}
Preview
文字路径
<com.meis.widget.MeiTextPathView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
属性
<declare-styleable name="MeiTextPathView">
<!-- 路径文字 -->
<attr name="text" format="string"/>
<!-- 路径文字大小 -->
<attr name="textSize" format="dimension"/>
<!-- 路径文字颜色 -->
<attr name="textColor" format="color"/>
<!-- 路径绘制时长 -->
<attr name="duration" format="integer"/>
<!-- 文字的描边宽度 -->
<attr name="strokeWidth" format="dimension"/>
<!-- 是否循环绘制 -->
<attr name="cycle" format="boolean"/>
<!-- 是否自动开始播放 -->
<attr name="autoStart" format="boolean"/>
</declare-styleable>
参考文章
1、弹跳小球
<com.meis.widget.ball.BounceBallView
android:layout_width="match_parent"
android:layout_height="wrap_content">
属性
- bounce_count :小球弹跳次数
- ball_color:小球颜色
- ball_count:小球数量
- ball_radius:小球半径
- ball_delay:小球出现时间间隔(当小球数大于1时)
- anim_duration:小球一次动画时长
- physic_mode : 开启物理效果(下落加速上升减速)
- random_color: 开启小球颜色随机
- random_radius: 开启小球大小随机(在基础大小上下浮动)
- random_path: 开启小球路径随机(在基础路径坐标上下浮动)
参考文章
2、扩散圆(主题切换)
<com.meis.widget.MeiRippleView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
方法
/**
* @param startX 被点击view相对屏幕的 view中心点x坐标
* @param startY 被点击view相对屏幕的 view中心点y坐标
* @param startRadius 开始扩散的半径
*/
public void startRipple(int startX, int startY, int startRadius)
参考文章
Android自定义View实现炫酷的主题切换动画(仿酷安客户端)
3、酷炫的路径
<com.meis.widget.MeiLinePathView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
参考文章
4、滚动视差
<com.meis.widget.MeiScrollParallaxView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
属性
<declare-styleable name="MeiScrollParallaxView">
<!-- 滚动速率 (0~1) 值越大滚动视差越明显 -->
<attr name="parallaxRate" format="float"/>
<!-- 滑动是否显示视差 默认 true -->
<attr name="enableParallax" format="boolean"/>
<!-- 圆角宽度 默认 0 若通过修改父类来实现 则不需要设置此值-->
<attr name="roundWidth" format="dimension"/>
<!-- 是否显示圆形 默认 0 若通过修改父类来实现 则不需要设置此值-->
<attr name="enableCircle" format="boolean"></attr>
<!--圆角外的颜色 默认白色 若通过修改父类来实现 则不需要设置此值-->
<attr name="outRoundColor" format="color"/>
</declare-styleable>
5、直播间送爱心
<com.meis.widget.heart.MeiHeartView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
属性
<declare-styleable name="MeiHeartView">
<!--爱心动画时长-->
<attr name="heartDuration" format="integer"/>
<!--是否显示透明度动画-->
<attr name="heartEnableAlpha" format="boolean"/>
<!--是否显示缩放动画-->
<attr name="heartEnableScale" format="boolean"/>
</declare-styleable>
6、selector控件集
效果图:
通过 xml 布局的方式替换掉 selector 文件。这么做的优势在于,减少 apk 体积,避免后期维护大量的 selector 文件,扩展性更强,功能更加强大。
1、特性
- 支持圆角(四个角度,圆角半径是高度的一半)
- 支持背景Pressed,Disabled,Selected,Checked四种状态
- 支持描边(虚线,四种状态)
- 支持文本(四种状态)
- 支持涟漪(水波纹)
- leftDrawable,topDrawable,rightDrawable,bottomDrawable(四种状态)
2、支持原生控件
- RadiusTextView
- RadiusCheckBox
- RadiusEditText
- RadiusFrameLayout
- RadiusLinearLayout
- RadiusRelativeLayout
3、扩展
委托的扩展方式(Delegate),参考的是(AppCompatActivity实现方式),具体请参考(RadiusTextView)
7、仿百度浏览器图片拖拽控件
效果图
参考代码 xml布局文件
//PhotoDragRelativeLayout 委托的方式 易扩展
<com.meis.widget.photodrag.PhotoDragRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pdr_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:navigationIcon="@mipmap/ic_arrow_back_white_24dp"
app:title="仿百度浏览器图片拖拽控件"
app:titleTextColor="#FFF" />
<me.relex.photodraweeview.PhotoDraweeView
android:id="@+id/pdv_photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:src="@mipmap/ic_mei_ripple" />
</com.meis.widget.photodrag.PhotoDragRelativeLayout>
代码
mPdrLayout.setDragListener(new PhotoDragHelper().setOnDragListener(new PhotoDragHelper.OnDragListener() {
@Override
public void onAlpha(float alpha) {
mPdrLayout.setAlpha(alpha);
}
@Override
public View getDragView() {
return mPdvView;
}
@Override
public void onAnimationEnd(boolean mSlop) {
if (mSlop) {
finish();
overridePendingTransition(0, 0);
}
}
}));
Contact
QQ群:478720016
LICENSE
Copyright 2018 文淑
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.
Recommend
-
37
Mad-Metasploit是一款针对Metasploit的多功能框架,该框架提供了多种自定义模块、插件和资源脚本。 如何将Mad-Metasploit添加到Metas...
-
51
SilkETW SilkETW是一款针对ETW(Event Tracing for Windows)的自定义C#封装工具,该工具可以通过抽象化的方式简化ETW的复杂性,并...
-
44
一、概述 OpenPLC是一个基于易于使用软件的开源可编程逻辑控制器。OpenPLC项目是根据IEC 61131-3标准创建的,该标准定义了PLC的基本软件架构和编程语言。 二、系统构成 OpenPLC项目由三部分组成:运行时(...
-
14
Nuclei是一款运行速度非常快且易于使用的扫描工具,它可以帮助研究人员基于模板执行可配置的目标扫描任务,并提供了大量可扩展接口以辅助使用。 Nuclei可以基于模板来跨目标发送请求,能够实现零误报,并且可以帮助研究人员对...
-
24
CWFF CWFF是一款专用于模糊测试的自定义字典工具,该工具可以帮助广大研究人员以高速并发的形式创建一个特定的高质量模糊测试...
-
9
guide-rpc-framework 中文|English Sorry, I did not fully translate the Chinese readme. I have translated the important parts. You can transla...
-
6
【Awsome】GitHub 资源汇总 1年前 ⋅ 220...
-
7
Files Permalink Latest commit message Commit time
-
11
Android开发中,EditText的使用 非常常见 本文将手把手教你做一款 附带一键删除功能 & 自定义样式丰富的 SuperEditText控件,希望你们会喜欢。
-
6
V2EX › 程序员 如果我开发一款聊天 APP 能自定义信息提示音,能否超越微信?
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK