Professional Documents
Culture Documents
12 - My Number Guessing Game - Part I (Splash Screen)
12 - My Number Guessing Game - Part I (Splash Screen)
OBJECTIVES
LAYOUT – SPLASH
ATTRIBUTES
1. In the Attributes window, click the plus button to create top, bottom, left or right
constraints.
2. Set only the top and bottom constraints. You could use any value. Your screen should be
display below.
TextView id textView
layout_width 300dp
layout_height Wrap_content
text Number Guessing Game
textColor #F60303
android:textAlignment = “center”
TO CENTER THE TEXTVIEW HORIZONTALLY
When you use ConstraintsLayout, you need set a constraints on the component. To set a constraints
in the ImageView.
1. In the Project window, right-click in res folder. Click New -> Android Resource Directory.
2. The “New Resource Directory” will display. Select the “anim” folder then click the OK
button.
3. The “anim” folder will then be created inside the “res” folder as shown.
CREATE ANIMATION RESOURCE FILE
1. Right-click in the “anim” folder, Select New -> Animation Resource File.
2. The “New Resource File” dialog box will then display. Type “image_animation” as the file
name then click the “OK” button.
3. The image_animation.xml will then be created.
4. Right-click in the “anim” folder, Select New -> Animation Resource File.
5. The “New Resource File” dialog box will then display. Type “text_animation” as the file name
then click the “OK” button.
2. Implement the methods for the CountDownTimer method. Click on the line “new
CountDownTimer” and click the light bulb icon.
3. Select “Implement methods” from the options.
4. The “Select Methods to Implement” dialog box will then display. The two methods is
already selected. Click the “OK” button.
5. The two methods will then be created.
7. To remove the error on the onFinish method, click on the line. Right click, select “Show
Context Actions”.
8. Select “Import Class”
The package will be imported and the error will then be removed.
2. Highlight the following code and press Ctrl + X or right-click then select the “Cut” command.
3. Paste it after the
<activity
android:name = “SplashActivty”
android:exported = true
4. Remove the slash in the first activity tag.
5. Put the closing tag for the activity.