我使用ShowcaseView
定位了操作栏中的项目,但我无法定位ListView
的元素!我试过了,它没有用:
ShowcaseView sv = new ShowcaseView.Builder(this,true)
.setTarget(new ViewTarget(lv.getChildAt(1).findViewById(R.id.heart)))
// Here is where you supply the id of the action bar item you
// want to display
.setContentTitle("Heart")
.setContentText("Check the venues of your city")
.hideOnTouchOutside()
.build();
答案 0 :(得分:1)
很简单。获取ViewHolder
中的元素,然后放置代码以在ShowCaseView
内显示bindView
。
不要忘记为列表中的每个元素添加不同的ID。
所以你可以尝试这样的事情。
public class ViewHolder extends RecyclerView.ViewHolder {
private TextView button;
public ViewHolder(final View itemView) {
super(itemView);
button = (Button) itemView.findViewById(R.id.list_button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new MaterialShowcaseView.Builder(getActivity())
.setTarget(verifyButton)
.setDismissText("GOT IT")
.setContentText("Your text goes here")
.setDelay(100) // optional but starting animations immediately in onCreate can make them choppy
.singleUse(id + " define an unique id for each item of the list") // provide a unique ID used to ensure it is only shown once
.show();
}
});
}
}
}
要获取更多信息,您可以check the library here。