android 给图片蒙上蒙层_Android页面中引导蒙层的使用方法详解

蒙层是什么,蒙层是一层透明的呈灰色的视图,是在用户使用App时让用户快速学会使用的一些指导。类似于一些引导页面,只不过比引导页面更加生动形象而已。在GitHub上有具体的demo。地址为github源码地址,需要的可以去上面下载源码看看使用引导蒙层非常简单,只要在你的项目中导入一个GuideView类即可,当然,别忘了在values的资源文件下加上相应的一些数值。下面是GuideView的原...
摘要由CSDN通过智能技术生成

蒙层是什么,蒙层是一层透明的呈灰色的视图,是在用户使用App时让用户快速学会使用的一些指导。类似于一些引导页面,只不过比引导页面更加生动形象而已。在GitHub上有具体的demo。

地址为   github源码地址,需要的可以去上面下载源码看看

使用引导蒙层非常简单,只要在你的项目中导入一个GuideView类即可,当然,别忘了在values的资源文件下加上相应的一些数值。

下面是GuideView的原码

public class GuideView extends RelativeLayout implements ViewTreeObserver.OnGlobalLayoutListener {

private final String TAG = getClass().getSimpleName();

private Context mContent;

private List mViews;

private boolean first = true;

/**

* targetView前缀。SHOW_GUIDE_PREFIX + targetView.getId()作为保存在SP文件的key。

*/

private static final String SHOW_GUIDE_PREFIX = "show_guide_on_view_";

/**

* GuideView 偏移量

*/

private int offsetX, offsetY;

/**

* targetView 的外切圆半径

*/

private int radius;

/**

* 需要显示提示信息的View

*/

private View targetView;

/**

* 自定义View

*/

private View customGuideView;

/**

* 透明圆形画笔

*/

private Paint mCirclePaint;

/**

* 背景色画笔

*/

private Paint mBackgroundPaint;

/**

* targetView是否已测量

*/

private boolean isMeasured;

/**

* targetView圆心

*/

private int[] center;

/**

* 绘图层叠模式

*/

private PorterDuffXfermode porterDuffXfermode;

/**

* 绘制前景bitmap

*/

private Bitmap bitmap;

/**

* 背景色和透明度,格式 #aarrggbb

*/

private int backgroundColor;

/**

* Canvas,绘制bitmap

*/

private Canvas temp;

/**

* 相对于targetView的位置.在target的那个方向

*/

private Direction direction;

/**

* 形状

*/

private MyShape myShape;

/**

* targetView左上角坐标

*/

private int[] location;

private boolean onClickExit;

private OnClickCallback onclickListener;

private RelativeLayout guideViewLayout;

public void restoreState() {

Log.v(TAG, "restoreState");

offsetX = offsetY = 0;

radius = 0;

mCirclePaint = null;

mBackgroundPaint = null;

isMeasured = false;

center = null;

porterDuffXfermode = null;

bitmap = null;

needDraw = true;

// backgroundColor = Color.parseColor("#00000000");

temp = null;

// direction = null;

}

public int[] getLocation() {

return location;

}

public void setLocation(int[] location) {

this.location = location;

}

public GuideView(Context context) {

super(context);

this.mContent = context;

init();

}

public int getRadius() {

return radius;

}

public void setRadius(int radius) {

this.radius = radius;

}

public void setOffsetX(int offsetX) {

this.offsetX = offsetX;

}

public void setOffsetY(int offsetY) {

this.offsetY = offsetY;

}

public void setDirect

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值