I found examples for the legacy version, but not for the new builder pattern. Does anyone know how to do this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The Builder constructor only needs an activity public Builder(Activity activity)
so:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment, container, false);
showcaseView = new ShowcaseView.Builder(getActivity())
.setTarget(new ViewTarget(view.findViewById(R.id.textView)))
.setOnClickListener(listener)
.build();
....