Hi I am trying to make a layout dynamically and it should be scrollable because I will not know how many text fields and edit text fields I should draw. The picture is shown below.
LinearLayout layout=new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
setContentView(layout);
Enclose your parent layout (LinearLayout or RelativeLayout) in a
ScrollView
. Thats all you need to fix this.ScrollView can have only one child directly.
For java file you can create this xml file like below first and set that in content view
and than
instead of this line
and than add your views inside this
like above line add your views.
There is a layout that does this. Use the ScrollView.
EDIT:
You can do something like this:
And just all the controls to
layout
.