dependencies {
implementation 'com.qw:curtain:0.0.5'
}
複製代碼
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.show();
}
複製代碼
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.withPadding(findViewById(R.id.textView),24)
.show();
}
複製代碼
private void showCurtain(){
new Curtain(MainActivity.this)
.with(findViewById(R.id.textView))
.with(findViewById(R.id.imageView))
.show();
}
複製代碼
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();
}
複製代碼
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();
}
複製代碼
/** * 高亮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();
}
複製代碼
Github地址java