Search code examples
google-glassgoogle-gdk

CardScrollView in fragment


I am trying to return CardScrollView custom control from Custom Fragment's onCreateView method. The fragment is created programatically.

If I do not use fragment, instead use directly as activity layout, everything is working fine. But when I return it from Custom Fragment's onCreateView method, all I can see is blank screen.

Please help me out how to do it?

Thank you.


Solution

  • I fixed it. In onCreateView, where I created my Custom view of CardScrollView, I also have to activate the view by calling its activate method. Then it works fine. Code is as follows:

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
    
        CustomCardScrollView vu = new CustomCardScrollView(ctx);
        vu.activate();
        return vu;
    }