soulqw / Curtain
一个Android 高亮View蒙层库
Stars: ✭ 492
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Curtain
Helm Doc Zh Cn
Try to translate the helm official docs to Chinese. Helm官方文档中文翻译。如果大家觉得这个项目还可以,麻烦打一下右上角的Star按钮,谢谢。此网址查看更方便,欢迎大家提bug,
Stars: ✭ 319 (-35.16%)
Mutual labels: guide
Bgatransformerstip Android
Android 通用 PopupWindow,再也不用找 UI 小姐姐切 .9 图片了,大致能为你节省 30 分钟的开发时间
Stars: ✭ 372 (-24.39%)
Mutual labels: guide
Gamingtweaks
Windows 10 and (some) Linux Gaming Tweaks without myths
Stars: ✭ 463 (-5.89%)
Mutual labels: guide
Awesome Coins
₿ A guide (for humans!) to cryto-currencies and their algos.
Stars: ✭ 3,469 (+605.08%)
Mutual labels: guide
C Cpp Notes
Notes about modern C++, C++11, C++14 and C++17, Boost Libraries, ABI, foreign function interface and reference cards.
Stars: ✭ 363 (-26.22%)
Mutual labels: guide
Guide
Serverless Guide - An open-source definitive guide to serverless architectures.
Stars: ✭ 421 (-14.43%)
Mutual labels: guide
Opencore Vanilla Desktop Guide
Host for files for the OpenCore Vanilla Desktop Guide
Stars: ✭ 299 (-39.23%)
Mutual labels: guide
Django Api Domains
A pragmatic styleguide for Django API Projects
Stars: ✭ 365 (-25.81%)
Mutual labels: guide
Techinterview
💎 Cheat sheet to prep for technical interviews.
Stars: ✭ 454 (-7.72%)
Mutual labels: guide
V2ray Step By Step
This repo is a fork of ToutyRater/v2ray-guide, we aim to provide a new step-by-step guide of v2ray
Stars: ✭ 341 (-30.69%)
Mutual labels: guide
Gradle Kotlin Dsl Migration Guide
The missing migration guide to the Gradle Kotlin DSL
Stars: ✭ 364 (-26.02%)
Mutual labels: guide
Webapp Checklist
Technical details that a programmer of a web application should consider before making the site public.
Stars: ✭ 320 (-34.96%)
Mutual labels: guide
Spark Gotchas
Spark Gotchas. A subjective compilation of the Apache Spark tips and tricks
Stars: ✭ 308 (-37.4%)
Mutual labels: guide
Bad Data Guide
An exhaustive reference to problems seen in real-world data along with suggestions on how to resolve them.
Stars: ✭ 3,862 (+684.96%)
Mutual labels: guide
Introneuralnetworks
Introducing neural networks to predict stock prices
Stars: ✭ 486 (-1.22%)
Mutual labels: guide
Intro.js
Lightweight, user-friendly onboarding tour library
Stars: ✭ 20,826 (+4132.93%)
Mutual labels: guide
Curtain
一个更简洁好用的高亮蒙层库:
- 一行代码完成某个View,或者多个View的高亮展示
- 支持基于AapterView(如ListView、GridView) 和RecyclerView 的item以及item中元素的高亮
- 自动识别圆角背景,也可以自定义高亮形状
- 高亮区域支持自定义大小、操作灵活
- 顺应变化,基于Android X
- 配置简单,导入方便
Installation:
dependencies {
implementation 'com.qw:curtain:0.0.9'
}
Usage:
- 仅仅是高亮某个View
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.show();
}
- 如果你希望那个view的蒙层区域更大一些:
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.withPadding(findViewById(R.id.textView),Padding.all(10))
.show();
}
- 也可以同时高亮多个View:
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.with(findViewById(R.id.imageView))
.show();
}
- 如果你在蒙层上加上一些其他的元素,可以额外传入View布局:
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.setTopView(R.layout.nav_header_main)
.show();
}
- 如果你想监听蒙层的展示或者消失的回调:
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.imageView))
.setCallBack(new Curtain.CallBack() {
@Override
public void onShow(IGuide iGuide) {
}
@Override
public void onDismiss(IGuide iGuide) {
}
}).show();
}
- 默认会识别View的背景而生成相关高亮区域的形状,也可以自定形状:
private void showThirdGuide() {
new Curtain(SimpleGuideActivity.this)
.with(findViewById(R.id.btn_shape_custom))
//圆角
.withShape(findViewById(R.id.btn_shape_custom), new RoundShape(12))
//椭圆形
// .withShape(findViewById(R.id.btn_shape_custom),new CircleShape())
// 也可继承自 Shape 自己实现形状
// .withShape(findViewById(R.id.btn_shape_custom), new Shape() {
// @Override
// public void drawShape(Canvas canvas, Paint paint, HollowInfo info) {
//draw your shape here
// }
// })
.show();
}
- 在ListView 或者GridView 中使用:
/**
* 高亮item
*/
private void showGuideInItem() {
View item1 = ViewGetter.getFromAdapterView(listView, 5);
View item2 = ViewGetter.getFromAdapterView(listView, 2);
//如果你的View的位置不在屏幕中,返回值为null 需要判空处理
if (null == item1 || null == item2) {
return;
}
new Curtain(this)
.with(item1)
.with(item2)
.show();
}
/**
* 高亮item中的元素
*/
private void showGuideInItemChild() {
View item1 = ViewGetter.getFromAdapterView(listView, 1);
View item2 = ViewGetter.getFromAdapterView(listView, 3);
//如果你的View的位置不在屏幕中,返回值为null 需要判空处理
if (null == item1 || null == item2) {
return;
}
new Curtain(this)
.withShape(item1.findViewById(R.id.image), new CircleShape())
.with(item2.findViewById(R.id.tv_text))
.show();
}
效果:
- 其他一些功能介绍:
private void showCurtain() {
new Curtain(MainActivity.this)
.with(findViewById(R.id.imageView))
//是否允许回退关闭蒙层
.setCancelBackPressed(false)
// 设置蒙层背景颜色
.setCurtainColor(0x88000000)
// 设置蒙层出现的动画 默认渐隐
.setAnimationStyle(R.style.testAnimation)
.show();
}
CurtainFlow
如果你想按照一定的顺序去高亮一些列的View,可以方便的管理前进后退,减少方法的嵌套的场景下推荐使用:
- 仅仅需要按照步骤的Id,和构建你想要高亮的Curtain对象,统一交给CurtianFlow来处理
private void showInitGuide() {
new CurtainFlow.Builder()
.with(ID_STEP_1, getStepOneGuide())
.with(ID_STEP_2, getStepTwoGuide())
.with(ID_STEP_3, getStepThreeGuide())
.create()
.start(new CurtainFlow.CallBack() {
@Override
public void onProcess(int currentId, final CurtainFlowInterface curtainFlow) {
switch (currentId) {
case ID_STEP_2:
//回到上个
curtainFlow.findViewInCurrentCurtain(R.id.tv_to_last)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
curtainFlow.pop();
}
});
break;
case ID_STEP_3:
curtainFlow.findViewInCurrentCurtain(R.id.tv_to_last)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
curtainFlow.pop();
}
});
//重新来一遍,即回到第一步
curtainFlow.findViewInCurrentCurtain(R.id.tv_retry)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
curtainFlow.toCurtainById(ID_STEP_1);
}
});
break;
}
//去下一个
curtainFlow.findViewInCurrentCurtain(R.id.tv_to_next)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
curtainFlow.push();
}
});
}
});
}
2.效果
- APi细节上可以参考Demo
联系我(注明来意):
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].