Monday, August 8, 2011

Android User Interface Development Beginner's Guide






Table of Contents
Preface 1
Chapter 1: Developing a Simple Activity 11
Developing our first example 11
Creating the project structure 12
Time for action – setting up the Android SDK 12
Time for action – starting a new project 13
Examining the Android project layout 14
Time for action – running the example project 14
The screen layout 15
The layout XML file 16
Resource selection qualifiers 16
Time for action – setting up the question activity 18
Populating a View and a ViewGroup 19
Time for action – asking a question 19
Time for action – adding a space for answers 21
Time for action – adding more buttons 23
Defining common dimensions 25
Limitations of the layout XML format 27
Populating the QuestionActivity 29
Time for action – writing more Java code 30
Dynamically creating widgets 32
Time for action – putting the questions on the screen 32
Handling events in Android 34
Summary 36
Chapter 2: Presenting Data for Views 37
Listing and selecting data 38
ListView choice modes 38
No selection mode – CHOICE_MODE_NONE 38
Single selection mode – CHOICE_MODE_SINGLE 39
Multiple selection mode – CHOICE_MODE_MULTIPLE 40
Adding header and footer widgets 40
Creating a simple ListView 41
Time for action – creating a fast food menu 41
Styling the standard ListAdapters 43
Defining standard dimensions 43
Time for action – improving the restaurant list 44
Creating custom adapters 47
Creating a menu for The Burger Place 47
Time for action – creating a Burger item layout 48
Time for action – presenting Burger objects 50
Creating TheBurgerPlaceActivity class 52
Time for action – implementing TheBurgerPlaceActivity 53
Registering and starting TheBurgerPlaceActivity 54
Using the ExpandableListView class 56
Creating ExpandableListAdapter implementations 57
Using the GridView class 58
Time for action – creating the fruit icon 59
Displaying icons in a GridView 60
Time for action – building the fruit menu 61
Time for action – creating the FourBucketsActivity 62
Summary 64
Chapter 3: Developing with Specialized Android Widgets 67
Creating a restaurant review application 68
Time for action – creating the robotic review project structure 68
Building a TabActivity 70
Creating tab icons 70
Android tabs and icons 71
Implementing the ReviewActivity 72
Time for action – writing the ReviewActivity class 72
Time for action – creating the Review layout 74
Working with switcher classes 75
Time for action – turning on the TextSwitcher 76
Creating a simple photo gallery 78
Time for action – building the Photos tab 79
Creating a thumbnail widget 80
Implementing a GalleryAdapter 80
Time for action – the GalleryAdapter 81
Time for action – making the gallery work 83
Building the reservation tab 86
Time for action – implementing the reservation layout 86
Time for action – initializing the reservation tab 89
Time for action – listening to the SeekBar 92
Time for action – selecting date and time 93
Creating 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 Activities and Intents 103
Exploring the Activity class 104
Using Bundle objects 105
Time for action – building an example game: "guess my number" 106
Creating and consuming intents 110
Defining Intent actions 111
Passing data in an Intent 112
Adding extra data to an Intent 112
Using advanced Intent features 113
Getting data back from an Intent 113
Time for action – viewing phone book contacts 114
Summary 118
Chapter 5: Developing Non-linear Layouts 119
Time for action – creating a layouts example project 120
FrameLayout 121
Common uses 121
Time for action – developing a FrameLayout example 122
Table Layout 126
Common uses 127
Using TableLayout for a memory game 127
Time for action – developing a simple memory game 128
AbsoluteLayout/Custom Layouts 133
Developing your own Layouts 134
Time for action – creating a custom layout 134
Using the CircleLayout 137
Time for action – finishing the CircleLayout example 137
RelativeLayout 140
Common uses 140
Integrating the RelativeLayout 141
Time for action – creating a contact editor 141
Time for action – integration with the layout example 144
SlidingDrawer 146
Common uses 146
Creating a SlidingDrawer example 147
Time for action – creating a SlidingDrawer 147
Time for action – sliding drawer integration 148
Summary 150
Chapter 6: Validating and Handling Input Data 153
Dealing with undesirable input 153
Correctly labeling input 154
Signaling undesirable input 154
Recovering from undesirable input 155
Giving users direct feedback 155
Avoiding invalid input entirely 156
Capturing date and time 156
Using spinners and ListView for selection 159
Changing the data set 159
Disabling selections 159
Capturing text input 160
Autocompleting text input 160
Building activities for results 162
Generic filtering search Activity 162
Time for action – creating the ListItemSelectionActivity 163
Time for action – creating an ArrayAdapter 164
Time for action – creating the CursorAdapter 165
Time for action – setting up the ListView 169
Time for action – filtering the list 170
Time for action – returning the selection 171
Using the ListItemSelectionActivity 172
Summary 174
Chapter 7: Animating Widgets and Layouts 175
Using standard Android animations 176
Time for action – animating a news feed 176
Using flipper and switcher widgets 181
Using the ImageSwitcher and TextSwitcher implementations 182
Animating layout widgets 182
Time for action – animating a GridView 183
Creating Custom Animations 187
Time for action – writing a custom animation 188
Time for action – making a Button vanish 189
Summary 192
Chapter 8: Designing Content-centric Activities 193
Considering design options when displaying content on an Android device 194
Considering user behavior 195
Drawing user attention 196
Displaying content with the WebView class 197
Using a WebView object 198
Time for action – creating a recipe viewer application 198
Taking WebView further 203
Creating relative layouts for content display 204
Taking full advantage of RelativeLayout 205
Considering Android layout constraints 206
Styling TextView objects 207
Time for action – developing specialized content views 210
Developing an online music store 213
Designing the music store 213
Developing the music store 215
Time for action – building a track item 218
Time for action – developing the main user interface layout 219
Time for action – developing the main user interface Java code 222
Summary 225
Chapter 9: Styling Android Applications 227
Working with style resources 228
Using shape resources 230
How shapes behave 231
Rendering lines 231
Time for action – drawing a broken line 231
Rendering rectangles 232
Time for action – creating a rounded border 232
Rendering ovals 234
Time for action – applying a gradient to an oval shape 235
Rendering rings 236
Time for action – rendering a spinner ring 237
Defining layers 238
Stretching using nine-patch images 239
Creating nine-patch images 240
Using bitmap images in Android 241
Handling different screen sizes 242
Handling different screen densities 243
Handling configuration changes 244
Providing landscape layouts 245
Providing text input on a landscape layout 246
Altering screen content 247
Summary
Chapter 10: Building an Application Theme 249
Creating a basic calculator layout 250
Designing a standard calculator 251
Time for action – building the standard calculator 252
Building the calculator styling 254
Time for action – creating the button images 255
Time for action – styling the calculator buttons 257
Time for action – styling the display 260
Scientific landscape layout 263
Defining string resources for the scientific layout 263
Styling the scientific layout 265
Building the scientific layout 265
Time for action – coding the scientific layout 266
Handling the Activity restart 269
Supporting hardware keyboards 270
Adding in display animations 271
Time for action – animating the display 271
Summary 274
Appendix: Pop quiz answers 275
Chapter 1 275
Layouts as XML fles 275
Populating an activity 275
Chapter 2 276
List views and adapters 276
Chapter 3 276
Gallery objects and ImageViews 276
Chapter 4 276
Intents & Activities 276
Chapter 5. 277
Custom layouts 277
Chapter 6 277
Text input 277
Chapter 8 277
The WebView widget 277
WebView versus native layouts 277
Chapter 10 278
Layout resources 278
Nine-Patch Images 278
Android resources 278
Index 279


Another Android Books
Download

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!