[android-developers] Horizontal & Vertical Scroll View
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
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home