I am making UI in android using java code because all UI information comming from server so we can't use xml but there is problem when I create 7 button on screen by giving information it is supporting ldpi but rest of devices it is not working code is as-
for (int index = 0; index <7; index++) {
Button objwidgetbutton = new Button(this);
LinearLayout.LayoutParams objlayoutbtnparams = new LinearLayout.LayoutParams(280,LinearLayout.LayoutParams.WRAP_CONTENT); // Verbose!
objwidgetbutton.setText("hiii");
objwidgetbutton.setBackgroundResource(R.drawable.ic_launcher);
llinner.addView(objwidgetbutton,objlayoutbtnparams);
}
objlinear.addView(llinner);
I am using this structure is as
<LinearLayout>
<LinearLayout>
<button/>#7
</LinearLayout>
</LinearLayout>
Please guide me Is I going right path or doing other things?Main things is that how to make screen support all resolution