How to use ShowCaseView v5 builder with fragments?

两盒软妹~` 提交于 2019-12-30 19:07:11

问题


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


来源:https://stackoverflow.com/questions/23805816/how-to-use-showcaseview-v5-builder-with-fragments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!