Lập trình android chapter05 XML layouts

39 196 0
Lập trình android chapter05 XML layouts

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

5 Android Basic XML Layouts Notes are based on: The Busy Coder's Guide to Android Development by Mark L Murphy Copyright © 2008-2009 CommonsWare, LLC ISBN: 978-0-9816780-0-9 & Android Developers http://developer.android.com/index.html Android – UI – Basic XML Layouts Basic XML Layouts - Containers Designing Complex Uis • Arguably, LinearLayout is the most common modeling tool It offers a "box" model similar to the Java-Swing Box-Layout • Thông thường, thiết kế UI tổ hợp hộp lồng thành phần hộp xếp theo hàng ngang (horizontal) hàng dọc (vertical) 2 Android – UI – Basic XML Layouts Basic XML Layouts - Containers Summary of Commonly-used Android containers LinearLayout (the box model), RelativeLayout (a rule-based model), and TableLayout (the grid model), along with ScrollView, a container designed to assist with implementing scrolling containers Other (ListView, GridView, WebView, MapView,…) discussed later 3 Android – UI – Basic XML Layouts Basic XML Layouts - Containers Before we get started … Android’s simplest layout manager is called: Frame Layout Một Frame Layout container hình chữ nhật mà thành phần (child) đính góc bên trái container Khi thêm view vào frame layout, xếp chồng lên view có 4 Android – UI – Basic XML Layouts Basic XML Layouts - Containers Before we get started … Hierarchy Viewer (\tools) 5 Android – UI – Basic XML Layouts Basic XML Layouts - Containers HierarchyViewer As in SDK 2.3 6 Android – UI – Basic XML Layouts Linear Layout Linear Layout LinearLayout is a box model – widgets or child containers are lined up in a column or row, one after the next To configure a LinearLayout, you have five main areas of control besides the container's contents: • • • • • • orientation, fill model, weight, gravity, padding , margin 7 Android – UI – Basic XML Layouts Linear Layout Linear Layout Orientation quy định LinearLayout biểu diễn dạng hàng hay dạng cột Giá trị thuộc tính android:orientation phần tử LinearLayout XML layout: giá trị horizontal cho dạng hàng, vertical cho dạng cột horizontal Có thể sửa orientation chạy mã chương trình với lệnh setOrientation() v e r t i c a l 8 Android – UI – Basic XML Layouts Linear Layout i c 9 Android – UI – Basic XML Layouts Linear Layout 1.2 • • Linear Layout: Fill Model Widgets have a "natural" size based on their accompanying text When their combined sizes does not exactly match the width of the Android device's screen, we may have the issue of what to with the remaining space natural sizes empty screen space 10 10 Android – UI – Basic XML Layouts Relative Layout Relative Layout – Example

Ngày đăng: 07/09/2017, 23:15

Hình ảnh liên quan

Dùng ScrollView khi dữ liệu cần hiển thị dài hơn 1 trang màn hình. - Lập trình android chapter05 XML layouts

ng.

ScrollView khi dữ liệu cần hiển thị dài hơn 1 trang màn hình Xem tại trang 34 của tài liệu.

Từ khóa liên quan

Mục lục

  • Slide 1

  • Slide 2

  • Slide 3

  • Slide 4

  • Slide 5

  • Slide 6

  • Slide 7

  • Slide 8

  • Slide 9

  • Slide 10

  • Slide 11

  • Slide 12

  • Slide 13

  • Slide 14

  • Slide 15

  • Slide 16

  • Slide 17

  • Slide 18

  • Slide 19

  • Slide 20

  • Slide 21

  • Slide 22

  • Slide 23

  • Slide 24

  • Slide 25

  • Slide 26

  • Slide 27

  • Slide 28

  • Slide 29

  • Slide 30

  • Slide 31

  • Slide 32

  • Slide 33

  • Slide 34

  • Slide 35

  • Slide 36

  • Slide 37

  • Slide 38

  • Slide 39

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan