Whammo Kablammo
Whammo Kablammo

Reputation: 46

How do i put a sprite on an android XML layout file?

I don't have any code in my frogger.xml file, and i need to get a picture of a frog at the bottom of the scereen, and be able to put the code for it in a different folder. How would i do this? (simply, please, I'm a beginner)

also, i am using eclipse and android 2.2

Upvotes: 0

Views: 758

Answers (1)

Vic Vuci
Vic Vuci

Reputation: 7051

This is extremely vague. But okay.

To put an image at the bottom of your screen, make your frogger.xml say this

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/frog" />

</RelativeLayout>

Where android:src="@drawable/frog" is pulling in the image of your frog (if its frog.png or something) from the res>drawable folder.

If you're planning on doing graphics and making a frogger game, you really need to look into other things first.

Upvotes: 1

Related Questions