I want to add horizontal and vertical scroll view in my Android application at runtime.
ScrollView sv = new ScrollView(this);
LinearLayout ll = new LinearLayout(this);
ll.setBackgroundResource(R.drawable.opsbuds);
ll.setLayoutParams (new LayoutParams
(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
ll.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(40, 20, 0, 0);
sv.addView(ll);
now my code is like this, but it is not working properly
ScrollView sv = new ScrollView(this);
HorizontalScrollView horizontal = new HorizontalScrollView(this);
LinearLayout ll = new LinearLayout(this);
ll.setBackgroundResource(R.drawable.opsbuds);
ll.setLayoutParams (new LayoutParams
(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
ll.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(40, 20, 0, 0);
horizontal.addView(ll);
by using above code I can add vertical scroll view. but when I use both horizontal ans vertical it is not coming properly...