Android Erası 2 - UI və layoutlar


Published on

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

Android Erası 2 - UI və layoutlar

  1. 1. Rajab Davudov
  2. 2. What is a Layout ?• A type of resource that defines what is drawn on the screen.• A type of View class whose primary purpose is to organize other controls.
  3. 3. Why a Layout ?• More than 300 deviceswith different – Screen sizes and dimensions – Screen densities – Android versions – OEM skins – Control interfaces
  4. 4. Android Layouts• LinearLayout• RelativeLayout• TableLayout• FrameLayout• AbsoluteLayout• …
  5. 5. Linear LayoutIn a linear layout, like the name suggests, all the elements aredisplayed in a linear fashion(below is an example of the linearlayouts), either Horizontally or Vertically and this behavior is setin android:orientation which is an attribute of the nodeLinearLayout.<LinearLayout android:orientation="vertical"> .... </LinearLayout>OR<LinearLayout android:orientation=“horizontal"> .... </LinearLayout>
  6. 6. Linear Layout
  7. 7. Relative LayoutIn a relative layout every element arranges itself relative to otherelements or a parent element.As an example, lets consider the layout defined below. The“Cancel” button is placed relatively, to the right of the “Login”button parallel. Here is the code snippet that achieves thementioned alignment (Right of Login button parallel)
  8. 8. Relative Layout
  9. 9. Table LayoutTable layouts in Android works in the same way HTML tablelayouts work. You can divide your layouts into rows and columns.Its very easy to understand. The image below should give you anidea
  10. 10. Table Layout
  11. 11. Absolute LayoutNon-professional and not recommended layout !!!
  12. 12. Custom Layout Resource• res/ – layout/ – layout-land/ – layout-xlarge-v11/ – layout-xlarge-land-v11/
  13. 13. Density Independent Pixels• dp or dip
  14. 14. Think, Design, Code !!!
  15. 15. Rajab Davudov Senior Developer at Azerfon radjab@gmail.com Market QR Code