我找到了旧版本的示例,但没有找到新构建器模式的示例。有谁知道怎么做?
答案 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();
....