1. 首页
  2. 移动开发
  3. Android
  4. android ui基础教程(英文版)

android ui基础教程(英文版)

上传者: 2019-09-09 04:07:40上传 PDF文件 3.6MB 热度 18次
android ui基础教程(英文版)Android UI Fundamentals: Develop and DesignPeachpit press49Eighth StreetBerkeley, CA 94710510/524-2221(fax)FindusontheWebatwww.peachpit.comToreporterrorspleasesendanotetoerrata@peachpit.comPeachpit Press is a division of Pearson EducationCopyright@ 2012 by Jason OstranderEditor: Clifford ColbyDevelopment editor: Robyn Thomasna vladCover design: Aren Howell StraigerInterior design: Mimi Heftitor: danielle fosIndexer: Valerie Haynes PerryNotice of rightsAll rights reserved. No part of this book may be reproduced or transmitted in any form by any meanselectronic, mechanical, photocopying, recording, or otherwise, without the prior written perofpublisherForinformationongettingpermissionforreprintsandexcerptscontactpermissions@peachpit.comNotice of LiabilityThe information in this book is distributed on an"As Is"basis without warranty. While every precaution hasbeen taken in the preparation of the book, neither the author nor Peachpit shall have any liability to anyperson or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly bythe instructions contained in this book or by the computer software and hardware products described in itTrademarksAndroid is a trademark of Google Inc, registered in the United States and other countries. Many of thedesignations used by manufacturers and sellers to distinguish their products are claimed as trademarksWhere those designations appear in this book, and Peachpit was aware of a trademark claim, the designations appear as requested by the owner of the trademark. All other product names and services identifiedthroughout this book are used in editorial fashion only and for the benefit of such companies with nointention of infringement of the trademark. No such use, or the use of any trade name, is intended toconvey endorsement or other affiliation with this bookISBN13:978-0-321-81458-6ISBN1O:O-321-81458-4987654321Printed and bound in the united states of americaTo my lovely wife, Susan,who tirelessly supports me in all of my adventuresACKNOWLEDGMENTSi could write an entire book thanking people for their help along the way. InsteadI'li have to settle for this short paragraph:Thanks to Chris H for pushing me to consider writing a book and giving meendless encouragement and support. To Cliff C for giving me the chance to writethis book. To Robyn T for keeping me on schedule despite my best efforts. ToJBL for fixing my code and rocking a mean bass guitar To Scout F and Myrna V.for working tirelessly when i was late getting chapters to them. To Lucas D andRob S for reading early chapters and giving me valuable feedback To the entireteam at double twist for their dedication to making great android software. Tothe android team at Google for creating a great platform. To my family for theircontinuing support despite my dropping off the face of the earth. To Peachpit forgiving me the opportunity to write this for you. And to you, the reader, for givingme the chance to teach you in whatever small way I canJason Ostrander is a web and mobile software developer working at Silicon valleystartup doubletwist, where he makes syncing media to Android phones simplePrior to that, he solved networking problems at energy management startupSentilla and defense company Northrop grumman Jason holds an Ms in electricalengineering from UCLA. He lives with his wife in San Francisco's Mission Districtwhere he spends his time searching for the perfect chile rellenoIV ANDROID UI FUNDAMENTALS: DEVELOP AND DESIGNCONTENTStroductioWelcome to androidPART 1 BASIC ANDROID UICHAPTER 1 GETTING STARTEDHello worldBasic structure of an Android App9Android ui basics14Tools22Wrapping Up32CHAPTER 2 CREATING YOUR FIRST APPLICATION34Creating an App36Getting Started with android viewsArranging Views41playing a52Understanding activitiesPreventing ANRs64Finishing the Time Tracker AppppingCHAPTERGOING FURTHER74Supporting Multiple Screen SizesHandling notifications84Handling events.92Creating menusImplementing the Time Tracker102appingCONTENTs VPART 2 THE VIEW FRAMEWORKCHAPTER 4 BASIC VIEWS.110Creating a Basic form112Displaying ImagesCreating Maps and Displaying Websites130Wrapping Up136CHAPTER 5 REUSABLE UI138Abstracting Your Layouts140Abstracting Styles and ThemesUsing FragmentsWrapping upCHAPTER 6 NAVIGATION AND DATA LOADING.164Introducing the action bar166Navigating Your App172Loading data into views181Wrapping UpCHAPTER7 ANDROID WIDGETS188Creating a Basic widge190Creating a Collection WidgetWrapping U211ANDROID UI FUNDAMENTALS: DEVELOP AND DESIGNPART 3 ADVANCED UI DEVELOPMENTCHAPTER 8 HANDLING GESTUreS.214Listening to Touch Events216Responding to gestures224pping Up229CHAPTER 9 ANIMATION.230Creating drawable animations232Creating view Animations235Creating Property Animationsrapping UpCHAPTER 10 CREATING CUSTOM VIEWS256Understanding how android Draws ViewsCreating a Custom viewAdding Custom Attributes to Your Custom views267Creating Compound Components274U279CHAPTER 11 CREATING ADVANCED GRAPHICS..280Using RenderScripUSing OpenGL294ping up3O1CHAPTER 12 LOCALIZATION AND ACCESSIBILITY302Making Your app available in Multiple languages304Making Your App accessible309315Inde316CONTENTs VILINTRODUCTIONThere is a revolution happening in the technology industry Touchscreen interfacescombined with low-coSt and ubiquitous smartphones, have created a perfect stormfor disruptive innovation. Android is at the forefront of this change, bringing a freeand open-source platform on which developers can create the next generation ofapplications. With free development tools and an open market, anyone can developapplications that reach a worldwide market. But why choose to develop for android?Android now runs on the majority of smartphones in the United States Andit's quickly expanding into new markets and device types. The last year has seenthe introduction of hundreds of Android-based tablets, including the hit KindleFire. Google has ported android to TVs with its Google TV platform, and manymanufacturers are beginning to ship tVs with android built in boeing has selectedAndroid as the entertainment platform for its new Dreamliner jet. Ford is integrating android into its in-dash SYNc entertainment system. And android is quicklygaining traction in the developing world, especially in Africa, where the need forlost handsets is greatestYet for all of the platforms promise, the majority of android applications stilllack the visual polish of their ios counterparts. This book aims to address thatissue by providing developers with a solid foundation for building app UIs. It willcover the basics of ui development on android, teach best practices for creatingflexible layouts, and give you tips on how to optimize your UI for smooth, fluidperformance. i created this book in the hope that it will help developers to createbeautiful applicationsWho am I? Ive been developing software professionally for almost ten yearsand I' ve focused on embedded and mobile software for the last five. In my day job,i work for one of the top android development companies and write code thatmillions of people use every dayAndroid development can be difficult at times, and the challenges of supportingsuch a diversity of devices can be daunting. But with a good idea, a solid understanding of the framework, and a little persistence, anyone can create a great appthat is used by millions of peopleI hope you' ll enjoy reading this book as much as i enjoyed writing it for youVII ANDROID UI FUNDAMENTALS: DEVELOP AND DESIGNWHO THIS BOOK IS FORThis book is aimed at beginning android developers who are interested in creatinggreat user interfaces. You are expected to know basic Java programming and XMLsyntax. The focus of this book is on UI. While you don' t need to have experiencewriting Android software, many basic Android concepts are only described inpassing. It will help you to have a rudimentary knowledge of android development.WHO THIS BOOK IS NOT FORThis book is not a general introduction to programming for Android. While it isintended for beginning Android developers, the focus is on user interface toolsand programming. In particular, this book will not cover basic Android conceptssuch as intents, services, or content providers. Further, this book will not be anintroduction to the java programming language or to XML. You should know howto program and how to read XMLHOW YOU WILL LEARNThroughout this book, you'll learn by creating an actual app, a simple timetracker Each chapter includes detailed examples of real android code that youwill compile and run. all code for the book can be found at the book's websitewww.peachpit.com/androiduifundamentalsWHAT YOU WILL LEARNYou'll learn how to create user interfaces for Android applications From the mostbasic concepts, like activities and views, all the way to advanced graphics usingRenderscript, this book covers everything you will use to build the user interfaceof your appsA NOTE ABOUT ANDROID VERSIONSThis book was written to Android version 4 APis and best practices, but it is compatible back to android version 2.2. When relevant, notes and tips are included toindicate when an APi is deprecated or no longer appropriate. The android compatibility library, a package of classes that back-port several newer features, willbe used throughout the book.INTRODUCTION X
下载地址
用户评论