Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can check the class <code>MyManager</code>. May be the same layout can be achieved with <code>HorizontalFieldManager</code>, but I failed several times when using <code>HorizontalFieldManager</code>.</p> <pre><code>public class MyScreen extends MainScreen { private BasicEditField _bef = new BasicEditField(); private ButtonField _bf1 = new ButtonField("Button"); private ButtonField _bf2 = new ButtonField("Button"); public MyScreen() { MyManager mgr = new MyManager(); _bef.setText("BasicEditField"); mgr.add(_bef); mgr.add(_bf1); mgr.add(_bf2); add(mgr); } } class MyManager extends Manager { private final int HORIZONTAL_GAP = 5; public MyManager() { super(0); } protected void sublayout(int width, int height) { int fields = getFieldCount(); Field field; int nHeight = 0; int remaininigWidth = width; int x0, x1, x2; // specific layout implementation only if (fields == 3) { // right most ButtonField field = getField(2); layoutChild(field, remaininigWidth, height); nHeight = Math.max(nHeight, field.getHeight()); remaininigWidth -= (field.getWidth() + HORIZONTAL_GAP); x2 = remaininigWidth; // middle ButtonField field = getField(1); layoutChild(field, remaininigWidth, height); nHeight = Math.max(nHeight, field.getHeight()); remaininigWidth -= (field.getWidth() + HORIZONTAL_GAP); x1 = remaininigWidth; // first BasicEditField field = getField(0); layoutChild(field, remaininigWidth, height); nHeight = Math.max(nHeight, field.getHeight()); x0 = 0; setPositionChild(getField(0), x0, (nHeight - getField(0).getHeight()) / 2); setPositionChild(getField(1), x1, (nHeight - getField(1).getHeight()) / 2); setPositionChild(getField(2), x2, (nHeight - getField(2).getHeight()) / 2); setExtent(width, nHeight); } else { setExtent(width, 0); } field = null; } } </code></pre>
 

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