C h a p t e r 02 194 Part
Mobile Apps 01 01 02 Chapter 02 195
03 04 196 Part
02 01 02 03 04 Chapter 02 197
05 06 07 08 198 Part
03 01 02 Chapter 02 199
03 04 05 06 200 Part
07 08 09 10 Chapter 02 201
04 01 02 03 202 Part
Mobile Apps Chapter 02 203
05 01 02 03 204 Part
06 01 02 07 01 02 Chapter 02 205
03 04 05 06 206 Part
07 08 09 Chapter 02 207
08 01 02 208 Part
09 01 02 Chapter 02 209
03 04 05 210 Part
06 06 Chapter 02 211
10 01 02 212 Part
Mobile Apps Chapter 02 213
11 01 02 03 04 214 Part
05 06 07 12 01 Chapter 02 215
02 03 13 01 02 216 Part
03 04 05 06 07 Chapter 02 217
Mobile Apps 218 Part
01 02 03 Chapter 02 219
220 Part
Chapter 02 221
1 2 3 4 222 Part
Chapter 02 223
<?xml version= 1.0 encoding= utf-8?> <android.support.design.widget.coordinatorlayout xmlns:android= http://schemas. android.com/apk/res/android xmlns:app= http://schemas.android.com/apk/res-auto xmlns:tools= http://schemas.android.com/tools android:layout_width= match_parent android:layout_height= match_parent tools:context= work.test.testandroid.mainactivity > <android.support.design.widget.appbarlayout android:layout_width= match_parent android:layout_height= wrap_content android:theme= @style/apptheme.appbaroverlay > <android.support.v7.widget.toolbar android:id= @+id/toolbar android:layout_width= match_parent android:background=?attr/colorprimary app:popuptheme= @style/apptheme.popupoverlay /> </android.support.design.widget.appbarlayout> <include layout= @layout/content_main /> 224 Part
<android.support.design.widget.floatingactionbutton android:id= @+id/fab android:layout_width= wrap_content android:layout_height= wrap_content android:layout_gravity= bottom end android:layout_margin= @dimen/fab_margin android:src= @android:drawable/ic_dialog_email /> </android.support.design.widget.coordinatorlayout> <?xml version= 1.0 encoding= utf-8?> <RelativeLayout xmlns:android= http://schemas.android.com/apk/res/android xmlns:app= http://schemas.android.com/apk/res-auto xmlns:tools= http://schemas.android.com/tools android:layout_width= match_parent android:layout_height= match_parent android:paddingbottom= @dimen/activity_vertical_margin android:paddingtop= @dimen/activity_vertical_margin app:layout_behavior= @string/appbar_scrolling_view_behavior tools:context= work.test.testandroid.mainactivity tools:showin= @layout/activity_main > <TextView android:layout_width= wrap_content android:layout_height= wrap_content </RelativeLayout> Chapter 02 225
226 Part
package work.test.testandroid; // import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.view.menu; import android.view.menuitem; public class MainActivity extends AppCompatActivity {// @Override @Override } } @Override return true; } @Override // Handle action bar item clicks here. The action bar will // as you specify a parent activity in AndroidManifest.xml. Chapter 02 227
return true; } } } 228 Part
Chapter 02 229
@Override } } 230 Part
Chapter 02 231
232 Part
<?xml version= 1.0 encoding= utf-8?> <manifest xmlns:android= http://schemas.android.com/apk/res/android package= work.test.testandroid > <application android:allowbackup= true android:icon= @mipmap/ic_launcher android:label= @string/app_name android:supportsrtl= true android:theme= @style/apptheme > <activity android:name=.mainactivity android:label= @string/app_name android:theme= @style/apptheme.noactionbar > <action android:name= android.intent.action.main /> <category android:name= android.intent.category.launcher /> </activity> </application> </manifest> Chapter 02 233