Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Can I disable the "sliding-gesture" in the ScrollableView?

I want to use it as a sort of holder of different views and use the sliding animation as a transition, but users shouldn't be able to switch between the views using this specific "sliding-gesture".

thx in advance

— asked July 27th 2010 by Julian Weimer
  • iphone mobile
0 Comments

4 Answers

  • What's in the child views inside the scrollableview? and it's a view-only objects or you planned to observe any touch events from this child view?

    There's always a work-wround, though not always pretty and cumbersome but doable. I'm not sure of the scope of your scrollview though, and the usage of the child views inside your scrollviews. You may able to achieve your goal by manipulating view container size wrapping your scrolling content.

    I have an ipad app with buttons as navigation, on click it will trigger different set of article list (categories) by scrolling to certain x point (vertical). The lists are preloaded inside a two ways scrollviews, and hidden lists are blocked by view where i don't want it to show. Within the list, user can scroll horizontally to click on article title to open webview, but not vertically.

    I went as far as communicate back to the scrollview child views by storing the views object in an arrays. Like i say, cumbersome but it gets the job done.

    — answered July 27th 2010 by Daniel Lim
    permalink
    0 Comments
  • You could set the touchEnabled property to false but I'm not sure the children of it will be able to receive the touch events after this.

    — answered July 27th 2010 by Dan Tamas
    permalink
    1 Comment
    • Just tested this out, thx for your quick answer. It didn't work as expected because the children were affected as well as you said it already.

      — commented July 27th 2010 by Julian Weimer
  • This was causing me trouble also, but I've found the answer. If you take a look at the kitchen sink application, you will see it does something similar to what you want in table_view_layout_2.js

    Essentially you use a tableview instead of a scrollableview. You then call:

    tableView.updateRow(0, newView, {animationStyle:Titanium.UI.iPhone.RowAnimationStyle.LEFT}));
    

    to "scroll" to the other view. When you're creating your tableview, specify:

    var tableView = Ti.UI.createTableView({
        data: [firstViewToDisplay],
        scrollable : false,
        allowsSelection : false,
    });
    

    It works well for me, and I hope it works for you too!

    — answered November 25th 2011 by John Farrelly
    permalink
    0 Comments
  • Guy, I have been trying to find a valid solution for this but add following code and it works perfectly fine.
    Add it at the point from where you dont want the scrollableview not scrolling

    YOUR_SCROLLABLEVIEW.setScrollingEnabled(false);
    
    — answered December 10th 2012 by Pratod Jawale
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.