android imageview and splash screen 1. after copying an image file (ctrl-c or right click copy),...
TRANSCRIPT
![Page 1: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/1.jpg)
Android ImageView and Splash Screen
1
![Page 2: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/2.jpg)
After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable folders of your project
2
![Page 3: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/3.jpg)
Problems with the file name: Invalid file name: must contain only [a-z0-9_.] Android is very sensitive about names
3
![Page 4: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/4.jpg)
After deleting, renaming the external file, copying and pasting
4
![Page 5: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/5.jpg)
If a file is in the folder but not visible in the package explorer, then go to Project/Clean
5
![Page 6: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/6.jpg)
After dragging an ImageView widget onto the layout, a dialog box appears, click on image name and OK (or double click on image name)
6
![Page 7: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/7.jpg)
Experiment with the ScaleType attribute
7
![Page 8: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/8.jpg)
Some changes to the ImageView attributes
<ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="98dp" android:layout_marginTop="58dp" android:src="@drawable/eduardkosmack" />
<ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/eduardkosmack" />
8
![Page 9: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/9.jpg)
So far (want it to fill the screen)
9
![Page 10: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/10.jpg)
Remove padding from the Layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" ><!--Removed from above android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" -->
10
![Page 11: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/11.jpg)
Closer (still not quite filling the screen)
11
![Page 12: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/12.jpg)
Add attributes to ImageView
<ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:adjustViewBounds="true" android:scaleType="fitXY" android:src="@drawable/eduardkosmack" />
12
![Page 13: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/13.jpg)
OK
13
![Page 14: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/14.jpg)
Add a new activity: right click on package New/Other
14
![Page 15: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/15.jpg)
Choose Android Activity Next/Next
15
![Page 16: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/16.jpg)
Give a name, click Next, review changes, click Finish
16
![Page 17: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/17.jpg)
Go to the AndroidManifest, switch the xml view tab
17
![Page 18: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/18.jpg)
Add an intent-filter for the new activity
18
![Page 19: Android ImageView and Splash Screen 1. After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable](https://reader036.vdocuments.net/reader036/viewer/2022062805/5697bfa71a28abf838c98ff9/html5/thumbnails/19.jpg)
Use Thread and sleep to wait on splash screen before moving to new activity
19
This way of instantiating an Intent and starting a new activity uses the intent-filter action name in the AndroidManifest