Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I set better button Layout programmatically for Multiple Resolution
    text
    copied!<p>I Have a set button on a Linear Layout, and I set the button configuration programmatically.</p> <pre><code>buttonEdit = new ArrayList&lt;ButtonData&gt;(); buttonEdit.add(new ButtonData(1, "one", R.drawable.1)); buttonEdit.add(new ButtonData(2, "two", R.drawable.2)); buttonEdit.add(new ButtonData(3, "three", R.drawable.3)); buttonEdit.add(new ButtonData(4, "four", R.drawable.4)); buttonEdit.add(new ButtonData(5, "five", R.drawable.5)); LayoutParams lp=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); for (ButtonData button : buttonEdit) { Button btn = new Button(getApplicationContext()); btn.setId(button.getButtonID()); btn.setBackgroundResource(button.getBackgroundResource()); btn.setOnClickListener(buttonOnclickListener); btn.setHeight(56); btn.setWidth(48); LinearLayout ll = new LinearLayout(getApplicationContext()); ll.setLayoutParams(lp); ll.setOrientation(LinearLayout.VERTICAL); ll.setPadding(10, 0, 10, 0); btn.setGravity(Gravity.CENTER_HORIZONTAL); TextView textLabel = new TextView(getApplicationContext()); textLabel.setText(button.getButtonName()); ll.addView(btn); ll.addView(textLabel); linearLayoutData.put(String.valueOf(button.getButtonID()), ll); buttonObject.put(String.valueOf(button.getButtonID()), btn); } </code></pre> <p>In list of code, I set a padding left and right 10. So the user can see a separate space between the buttons. So the problems is, when I install the apps in Multiple Resolutions (QVGA, HVGA, WVGA) it is spaced differently. In QVGA it's wider and in WVGA it's narrower. What will I do?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload