Search code examples
androidandroid-layoutandroid-gallery

How disable InfiniteGallery from responding to user Interaction


I'm trying to disable user interaction on com.blundell.tut.ui.view.InfiniteGallery, I've done everything,

  android:clickable="false" 
  android:focusable="false"
  galleryOne.setClickable(false);

add click and focusable on layout to true, and all still not working. I just want to disable users from being able to interact with it. Any other idea would be welcomed. Thanks.

 <LinearLayout
    android:id="@+id/galLay"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_marginBottom="10dip"
    android:layout_weight="1"
    android:padding="5dip"
    android:clickable="true" 
    android:focusable="false">

    <com.blundell.tut.ui.view.InfiniteGallery
        android:id="@+id/cardgallery"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:spacing="0dp"
        android:clickable="false" 
        android:focusable="false"/>
</LinearLayout>

Solution

  • Set an OnTouchListener on the InfiniteGallery instance, and just return true in the onTouch() method to signal that the event has been handled. For example:

    galleryOne.setOnTouchListener(new OnTouchListener()
        {
            @Override
            public boolean onTouch(View view, MotionEvent event)
            {               
                return true;
            }
        }
    );