如何使用ShowCaseView V5建设者片段?建设者、如何使用、片段、ShowCaseView

2023-09-07 11:02:08 作者:玛丽莲萌鹿

我发现示例,旧版本,而不是为新生成器模式。有谁知道如何做到这一点?

I found examples for the legacy version, but not for the new builder pattern. Does anyone know how to do this?

推荐答案

该生成器的构造函数只需要一个活动公共生成器(活动活动)这样:

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();
    ....