Creating a custom Gallery - overriding onFling

后端 未结 3 1550
暗喜
暗喜 2020-12-23 17:48

So, I\'ve followed this particular thread (How to stop scrolling in a Gallery Widget?) yet I am unable to get it to work properly.

I\'ve created a custom MyGallery c

相关标签:
3条回答
  • 2020-12-23 18:31

    Yes. You should just use com.gallerytest.mygallery instead of Gallery in XMLs. Everything will be working fine becuase mygallery is a subclass of Gallery. No need for imports in XML.

    0 讨论(0)
  • 2020-12-23 18:38

    Changing the XML was key...i had been getting TypeCastException for sometime and couldn't find the reason in my code. Finally found in this post " You should just use com.gallerytest.mygallery instead of Gallery in XMLs" and solved my problem. thanks a lot.

    0 讨论(0)
  • 2020-12-23 18:43

    Just add the attrSet param to the constructor of your custom gallery:

    super(ctx, attrSet);
    

    This worked for me. Leo Vannucci

    0 讨论(0)
提交回复
热议问题