在Fragment Activity中加载GestureLibrary不起作用

时间:2016-04-07 05:03:24

标签: java android

如何在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;

        }

1 个答案:

答案 0 :(得分:0)

可能会要求context并且由于fragment没有context而引发错误。 尝试使用这样:

mLibrary = GestureLibraries.fromRawResource(getActivity(), R.raw.gestures);