Android user interface development(2011)

304 303 0
Android user interface development(2011)

Đ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

Android user interface development(2011)

Android User Interface Development Beginner's Guide Quickly design and develop compelling user interfaces for your Android applicaons Jason Morris BIRMINGHAM - MUMBAI D ownload f r o m W o w ! e B o o k < w w w . w owebook.com> Android User Interface Development Beginner's Guide Copyright © 2011 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmied in any form or by any means, without the prior wrien permission of the publisher, except in the case of brief quotaons embedded in crical arcles or reviews. Every eort has been made in the preparaon of this book to ensure the accuracy of the informaon presented. However, the informaon contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark informaon about all of the companies and products menoned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this informaon. First published: February 2011 Producon Reference: 1160211 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-849514-48-4 www.packtpub.com Cover Image by Charwak A ( charwak86@gmail.com ) Credits Author Jason Morris Reviewers David J. Groom Marn Skans Acquision Editor Chaitanya Apte Development Editor Reshma Sundaresan Technical Editor Harshit Shah Copy Editor Neha Shey Indexer Tejal Daruwale Editorial Team Leader Akshara Aware Project Team Leader Priya Mukherji Project Coordinator Shubhanjan Chaerjee Proofreader Joel T. Johnson Graphics Nilesh R. Mohite Producon Coordinators Kruthika Bangera Aparna Bhagat Cover Work Kruthika Bangera About the Author Jason Morris has worked on soware as diverse as fruit tracking systems, insurance systems, and travel search and booking engines. He has been wring soware for as long as he can remember. He is currently working as a Soware Architect for Travelstart in South Africa. He works on mulple front-end and middleware systems, leveraging a variety of Java based technologies. The people I'd like to thank most for their direct, or indirect help in wring this book are my wife Caron Morris, my father Mike Morris, my mom Jayne Morris, and the rest of my family for their love and support. I'd also like to thank Wayne, Stuart, Angela, and James, and everyone on my team at Travelstart. Finally a very big thanks to Marn Skans for his invaluable input. About the Reviewer Marn Skans graduated from Lund University in Sweden, with a Master's degree in Computer Science. Aer a couple of years in the online markeng industry, he moved on to become a developer for Travelstart, an online travel agency. He relocated to Cape Town and is currently working on Travelstart's African travel plaorm which has been recently launched for the mobile market. www.PacktPub.com Support les, eBooks, discount offers and more You might want to visit www.PacktPub.com for support les and downloads related to your book. Did you know that Packt oers eBook versions of every book published, with PDF and ePub les available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com , you can also read a collecon of free technical arcles, sign up for a range of free newsleers and receive exclusive discounts and oers on Packt books and eBooks. http://PacktLib.PacktPub.com Do you need instant soluons to your IT quesons? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's enre library of books. Why Subscribe?  Fully searchable across every book published by Packt  Copy and paste, print and bookmark content  On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com , you can use this to access PacktLib today and view nine enrely free books. Simply use your login credenals for immediate access. Table of Contents Preface 1 Chapter 1: Developing a Simple Acvity 11 Developing our rst example 11 Creang the project structure 12 Time for acon – seng up the Android SDK 12 Time for acon – starng a new project 13 Examining the Android project layout 14 Time for acon – running the example project 14 The screen layout 15 The layout XML le 16 Resource selecon qualiers 16 Time for acon – seng up the queson acvity 18 Populang a View and a ViewGroup 19 Time for acon – asking a queson 19 Time for acon – adding a space for answers 21 Time for acon – adding more buons 23 Dening common dimensions 25 Limitaons of the layout XML format 27 Populang the QuesonAcvity 29 Time for acon – wring more Java code 30 Dynamically creang widgets 32 Time for acon – pung the quesons on the screen 32 Handling events in Android 34 Summary 36 Chapter 2: Presenng Data for Views 37 Lisng and selecng data 38 ListView choice modes 38 No selecon mode – CHOICE_MODE_NONE 38 Single selecon mode – CHOICE_MODE_SINGLE 39 Mulple selecon mode – CHOICE_MODE_MULTIPLE 40 Table of Contents [ ii ] Adding header and footer widgets 40 Creang a simple ListView 41 Time for acon – creang a fast food menu 41 Styling the standard ListAdapters 43 Dening standard dimensions 43 Time for acon – improving the restaurant list 44 Creang custom adapters 47 Creang a menu for The Burger Place 47 Time for acon – creang a Burger item layout 48 Time for acon – presenng Burger objects 50 Creang TheBurgerPlaceAcvity class 52 Time for acon – implemenng TheBurgerPlaceAcvity 53 Registering and starng TheBurgerPlaceAcvity 54 Using the ExpandableListView class 56 Creang ExpandableListAdapter implementaons 57 Using the GridView class 58 Time for acon – creang the fruit icon 59 Displaying icons in a GridView 60 Time for acon – building the fruit menu 61 Time for acon – creang the FourBucketsAcvity 62 Summary 64 Chapter 3: Developing with Specialized Android Widgets 67 Creang a restaurant review applicaon 68 Time for acon – creang the roboc review project structure 68 Building a TabAcvity 70 Creang tab icons 70 Android tabs and icons 71 Implemenng the ReviewAcvity 72 Time for acon – wring the ReviewAcvity class 72 Time for acon – creang the Review layout 74 Working with switcher classes 75 Time for acon – turning on the TextSwitcher 76 Creang a simple photo gallery 78 Time for acon – building the Photos tab 79 Creang a thumbnail widget 80 Implemenng a GalleryAdapter 80 Time for acon – the GalleryAdapter 81 Time for acon – making the gallery work 83 Building the reservaon tab 86 Time for acon – implemenng the reservaon layout 86 Time for acon – inializing the reservaon tab 89 Table of Contents [ iii ] Time for acon – listening to the SeekBar 92 Time for acon – selecng date and me 93 Creang complex layouts with Include, Merge, and ViewStubs 96 Using Include tags 97 Merging layouts 97 Using the ViewStub class 99 Summary 100 Chapter 4: Leveraging Acvies and Intents 103 Exploring the Acvity class 104 Using Bundle objects 105 Time for acon – building an example game: "guess my number" 106 Creang and consuming intents 110 Dening Intent acons 111 Passing data in an Intent 112 Adding extra data to an Intent 112 Using advanced Intent features 113 Geng data back from an Intent 113 Time for acon – viewing phone book contacts 114 Summary 118 Chapter 5: Developing Non-linear Layouts 119 Time for acon – creang a layouts example project 120 FrameLayout 121 Common uses 121 Time for acon – developing a FrameLayout example 122 Table Layout 126 Common uses 127 Using TableLayout for a memory game 127 Time for acon – developing a simple memory game 128 AbsoluteLayout/Custom Layouts 133 Developing your own Layouts 134 Time for acon – creang a custom layout 134 Using the CircleLayout 137 Time for acon – nishing the CircleLayout example 137 RelaveLayout 140 Common uses 140 Integrang the RelaveLayout 141 Time for acon – creang a contact editor 141 Time for acon – integraon with the layout example 144 SlidingDrawer 146 Common uses 146

Ngày đăng: 20/11/2013, 21:01

Từ khóa liên quan

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

Tài liệu liên quan