Note that there are some explanatory texts on larger screens.

plurals
  1. POScaling a simple UI with relative dimensions defined
    primarykey
    data
    text
    <p>What I have is a drawing of a UI layout, that I want to be able to scale up and down to fill an android screen. I know this doesn't really fit with the android UI "way" I've been reading about, but this is a very simple app for connection to an appliance - it has a couple of basic setting buttons, and a couple of realtime information display views.</p> <p>In this case, the UI elements all need dimensions that are known relative to the total width and height.</p> <p>I've had a play with doing a layout using a combination of linear and relative layout tags in XML, and given a fixed emulator screen setting, I can make an arrangement of interface elements with explicitly set sizes that fill it up the way I want... Of course this doesn't work when I try it on different screen sizes. </p> <p>So my next step is going to be to add code to calculate the size of each element just before the activity is first created - then override the xml values I use to do the original layout. I don't mind doing this, but am a bit worried that it means the UI design will be defined in multiple places, and this isn't really ideal.</p> <p>As I'm trying this, I'd really love to hear from more experienced developers if there's going to be a problem i haven't considered, and I'd be better off stopping any attempt to work with standard UI system Views and layouts, and jump straight to the 2D graphics library, or if there is a "nicer" way of setting relative sizes for objects in an XML layout related to device screen size that I've missed, despite my searching?</p> <p>thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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