一款可以通过简洁链式调用,一行代码实现引导层的显示,自动判断首次显示,当然也可以通过参数配置来满足不同的显示逻辑和需求。 通过自定义layout.xml实现文本及image的添加,非常方便位置的调整,避免代码调整各种不好控制的情况:实验5,6次才最终确定文字等的位置
Project build.gradle adds
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
build.gradle of module adds
dependencies {
compile 'com.github.huburt-Hu:NewbieGuide:v1.1.0'
}
Usage
The basic use:
NewbieGuide.with(this)//activity or fragment
.setLabel("guide1")//Set guide layer labeling to distinguish different guide layers, must be passed! Otherwise throw an error
.addHighLight(textView, HighLight.Type.RECTANGLE)//Add the view that needs to be highlighted
.setLayoutRes(R.layout.view_guide)//Custom guide layer layout, do not add background color, the boot layer background color is set by setBackgroundColor()
.show();
More parameter configuration
Controller controller = NewbieGuide.with(this)
.setOnGuideChangedListener(new OnGuideChangedListener() {//add listener
@Override
public void onShowed(Controller controller) {
//when guide layer display
}
@Override
public void onRemoved(Controller controller) {
//when guide layer dismiss
}
})
.setBackgroundColor(Color.BLACK)//Set the background color of the guide layer and suggest translucent. The default background color is: 0xb2000000
.setEveryWhereCancelable(false)//The Settings click anywhere to dismiss, and default is true
.setLayoutRes(R.layout.view_guide, R.id.textView)//The second variable parameter is to click on the view's id of the hidden guide layer view
.alwaysShow(true)//Show the boot layer each time,default is false
.build();//Build the controller for the guide layer
controller.resetLabel("guide1");
controller.remove();//remove the guide layer
controller.show();//show the guide layer