Ok my requirements for this were
1) need scrollview to do smooth scrolling however only wanted
scrolling to occur programmatically and not via touch
2) scrollview hijacks some touch events that stop the inner widgets
from working so didnt want this.
so I had to extend scrollview to meet my requirements:
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;
public class ScrollViewNoScroll extends ScrollView {
public ScrollViewNoScroll(Context context, AttributeSet attrs) {
super(context, attrs);
}
public boolean onTouchEvent(MotionEvent ev) {
return true;
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
}
On Aug 10, 7:44 pm, rukiman <[email protected]> wrote:
> Also I really want to use the .smoothScrollBy() function of the
> scrollView.
>
> On Aug 10, 7:39 pm, rukiman <[email protected]> wrote:
>
>
>
> > LinearLayout will not work for me as what I want to put in the
> > ScrollView is much larger than the screen.
> > So I think it is easier to use ScrollView as it knows to not render
> > the widgets until it scrolls onto view?
>
> > Unless can you get that behaviour using a LinearLayout?
>
> > On Aug 10, 7:32 pm, Atif Gulzar <[email protected]> wrote:
>
> > > do not use scrollView at all and use LinearLauout and use combination of
> > > touch events and scrollBy(int,
> > > int)<file:///E:/android-sdk-windows-1.5_r3/docs/reference/android/view/View
> > > .html#scrollBy%28int,%20int%29>,
> > > scrollTo(int,
> > > int)<file:///E:/android-sdk-windows-1.5_r3/docs/reference/android/view/View
> > > .html#scrollTo%28int,%20int%29>.
> > > By this way you can also achieve horizontal scrolling.
>
> > > --
> > > Best Regards,
> > > Atif Gulzar
>
> > > I ◘◘◘◘ Unicode, ɹɐzlnƃ ɟıʇɐ
>
> > > On Mon, Aug 10, 2009 at 2:50 PM, rukiman <[email protected]>
> > > wrote:
>
> > > > Just wondering if there is an easier way to simply stop ScrollView
> > > > from being scrolled via touch inputs? I will programmatically get the
> > > > ScrollView to scroll to top or bottom.
>
> > > > As a last resort, I guess I will have to inherit from ScrollView and
> > > > capture all the ontouch events. But wondering if there is an easier
> > > > way before I take this approach?
>
> > > > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---