Android : How to make the scrollview do not overflow in tablerow

on Friday, July 4, 2014


I want to make a layout that it


LinearLayout


ScrollView


LinearLayout


but it seems like the ScrollView has cover the rest of LinearLayout.



LinearLayout all = new LinearLayout(this);

LinearLayout upper = new LinearLayout(this);


LinearLayout footer = new LinearLayout(this);

ScrollView sv = new ScrollView(this);

all.setOrientation(LinearLayout.VERTICAL);
upper.setOrientation(LinearLayout.HORIZONTAL);
footer.setOrientation(LinearLayout.HORIZONTAL);

TextView code = new TextView(this);

code.setText("Code : ");

EditText codeEdit = new EditText(this);

upper.addView(code);
upper.addView(codeEdit);

LinkedList<LinearLayout> lk = new LinkedList<LinearLayout>();
TextView[] tt = new TextView[100];

LinearLayout ll= new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);

for(int a = 0 ; a < 100; a++){
LinearLayout temp = new LinearLayout(this);

temp.setOrientation(temp.HORIZONTAL);

tt[a] = new TextView(this);

tt[a].setText("Hello " + a);

temp.addView(tt[a]);

lk.add(temp);

ll.addView(temp);
}

sv.addView(ll);

Button next = new Button(this);

next.setText("Next");

footer.addView(next);


all.addView(upper);
all.addView(sv);
all.addView(footer);

setContentView(all);


The scrollview is too large and cover the rest of the linearlayout, the linearlayout after is not showing becasue of the scrollview. How can I actually solve this?


0 comments:

Post a Comment