Wednesday, December 22, 2010

[android-developers] Re: Horizontal & Vertical Scroll View

That is disappointing. From the other posts, it sure seemed like
people had gotten it to work.

I had actually found some code which modified the ScrollView code to
do bidirectional scrolls, but it did not compile, and I was hoping
that it would not be necessary to try and figure out why. This seems
like something that a lot of people might need. Why is it not
supported directly? What does the browser use (it allows you to
scroll in both directions)?

Thanks.

On Dec 22, 5:52 pm, Dianne Hackborn <hack...@android.com> wrote:
> You can't put a horizontal scroll view in a vertical scroll view.  You
> probably just want to take the implementation of scroll view and modify it
> to suit your needs.
>
>
>
> On Wed, Dec 22, 2010 at 3:21 PM, John Gaby <jg...@gabysoft.com> wrote:
> > I need to be able to have a view which scrolls both horizontally and
> > vertically (e.g. like a browser view).  I have seen several posts
> > where people have put a horizontal scroll view inside a vertical
> > scroll view.  I have tried to do that, but I only get vertical
> > scrolling.  The following is the code I am using:
>
> > public class ScrollTest extends Activity {
> >    /** Called when the activity is first created. */
> >    @Override
> >    public void onCreate(Bundle savedInstanceState)
> >    {
> >        super.onCreate(savedInstanceState);
>
> >        ScrollView sv = new ScrollView(this);
> >        HorizontalScrollView hsv = new HorizontalScrollView(this);
> >        ImageView iv = new ImageView(this);
>
> >        int id = getResources().getIdentifier(getPackageName() +
> > ":drawable/level1", null, null);
>
> >        if (id != 0)
> >        {
> >            iv.setImageResource(id);
> >        }
>
> >        hsv.addView(iv, new ViewGroup.LayoutParams(1000, 1000));
> >        sv.addView(hsv, new ViewGroup.LayoutParams(1000, 1000));
>
> >        setContentView(sv);
> >    }
> > }
>
> > Note that if I create just a HorzontalScrollView or just a ScrollView,
> > they both work independently.  When I combine them, I only get a
> > vertical scroll.  Does anyone have an Idea about what is wrong here?
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubscribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment