如何在Fragment Activity中加载Gesturelibrary ...请帮帮我
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view =inflater.inflate(R.layout.fragment_a, container, false);
//error is here..."this" is not working
mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
gestureOverlayView = (GestureOverlayView)view.findViewById(R.id.gestureOverlayView);
return view;
}
答案 0 :(得分:0)
可能会要求context
并且由于fragment
没有context
而引发错误。
尝试使用这样:
mLibrary = GestureLibraries.fromRawResource(getActivity(), R.raw.gestures);