#
引入庫
#####1. 從https://github.com/dogbrother/GuideView Download程式碼.
#####2. 引入guide
如何使用?
待高亮的View
mTextView = findViewById(R.id.tv);
/**
* 高亮區域1
*/
HighLight highLight = new HighLight(mTextView, HighLight.Type.ROUND_RECTANGLE);
highLight.setRound(12);
highLight.setPadding(12);
/**
* 高亮區域2
*/
HighLight highLight2 = new HighLight(mTextView, HighLight.Type.ROUND_RECTANGLE);
highLight2.setRound(20);
highLight2.setPadding(50);
/**
* 待加入引導的View
*/
View view = LayoutInflater.from(this).inflate(R.layout.item_test, null,false);
/**
* 建立高亮View
*/
GuideView guideView = new GuideView(view);
guideView.setRelativeView(mTextView);
guideView.setYInterval(100);
guideView.setOnGuideViewClickListener(new GuideView.OnGuideViewClickListener() {
@Override
public void onClick(Guide guide, View view) {
guide.nextOrRemove();
}
});
/**
* 建立引導類
*/
GuideView guideView1 = new GuideView(view);
//引導類的相對View
guideView1.setRelativeView(mTextView);
//引導類相對於相對View的位置
guideView.setRelative(GuideView.RELATIVE_BOTTOM | GuideView.RELATIVE_RIGHT);
//引導類相對相對View的Y的高度
guideView1.setYInterval(100);
guideView1.setRelative(GuideView.RELATIVE_TOP);
/**
* 建立引導
*/
Guide guide = new Guide.Builder(this)
.addHightLight(highLight)
.setOutsideCancelable(true)
.addGuideView(guideView)
.asPage()
.addHightLight(highLight2)
.addGuideView(guideView1)
.setOutsideCancelable(true)
.build();
guide.show();
複製程式碼