Working with Layouts: Android Programming

  • 6 лет назад
Guide to working with relative and linear layouts for the Android.\r
\r
UI with Layout\r
* Relative: Able to put things relative to each other.\r
- Really easy to mess-up UI, so only use a little.\r
- Put things in corners or middle.\r
\r
* Linear: Horizontal or vertical\r
+-------------------------------------+\r
| [Button] [Button] [Button] |\r
+-------------------------------------+\r
\r
* Why use a Layout?\r
- Better scaling to new screen sizes.\r
\r
Demo:\r
-------\r
Relative layout:\r
1. Activity with a relative layout.\r
2. Place some text in corners and middle.\r
3. Have 3 elements one-over next\r
\r
Linear Layout;\r
1. Activity with linear layout.\r
2. Place text one over next\r
\r
Both:\r
1. Activity with relative layout.\r
2. Add linear horizontal layout (centered)\r
3. Add text\r
\r
Nested:\r
1. To previous, add vertical linear layout.\r
2. Add items to it.\r
\r
\r
Advice: Planning Layouts\r
- Identify what elements are group together; put them in Linear layouts.