1 / 19

Android ImageView and Splash Screen

Android ImageView and Splash Screen. 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. Problems with the file name: Invalid file name: must contain only [a-z0-9_.] Android is very sensitive about names.

miron
Download Presentation

Android ImageView and Splash Screen

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Android ImageView and Splash Screen

  2. 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

  3. Problems with the file name: Invalid file name: must contain only [a-z0-9_.] Android is very sensitive about names

  4. After deleting, renaming the external file, copying and pasting

  5. If a file is in the folder but not visible in the package explorer, then go to Project/Clean

  6. After dragging an ImageView widget onto the layout, a dialog box appears, click on image name and OK (or double click on image name)

  7. Experiment with the ScaleType attribute

  8. 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" />

  9. So far (want it to fill the screen)

  10. Remove padding from the Layout <RelativeLayoutxmlns: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" -->

  11. Closer (still not quite filling the screen)

  12. 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" />

  13. OK

  14. Add a new activity: right click on package New/Other

  15. Choose Android Activity Next/Next

  16. Give a name, click Next, review changes, click Finish

  17. Go to the AndroidManifest, switch the xml view tab

  18. Add an intent-filter for the new activity

  19. Use Thread and sleep to wait on splash screen before moving to new activity This way of instantiating an Intent and starting a new activity uses the intent-filter action name in the AndroidManifest

More Related