如何将ShowCaseView v5构建器与片段一起使用?

时间:2014-05-22 11:41:04

标签: android showcaseview

我找到了旧版本的示例,但没有找到新构建器模式的示例。有谁知道怎么做?

1 个答案:

答案 0 :(得分:13)

Builder构造函数只需要一个活动public Builder(Activity activity),所以:

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