user1282588
user1282588

Reputation: 21

images are not set on screen properly?

I am making splash screen which background have images.I put 480x800 size image in drawable hdpi similarly rest of mdpi(320x480),lpdi(240x320).

Problem is that when i test hdpi emulator or other emulator image is not fit

code is as-

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">
   <ImageView 
    android:src="@drawable/splash" 
    android:id="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">
    </ImageView>
 </LinearLayout>

set into actvity simply..

Upvotes: 0

Views: 97

Answers (5)

Paresh Mayani
Paresh Mayani

Reputation: 128428

use android:scaleType attribute inside ImageView.

To know more about this property, go here => android:scaleType

Upvotes: 0

Alix Bloom
Alix Bloom

Reputation: 217

Try to use ImageView.ScaleType

Upvotes: 0

goodm
goodm

Reputation: 7295

Screens resolution is one thing but screen dimensions is something else. If you want to fill up full screen try using

android:scaleType = "fitXY"

in xml file. But this will stretch pic. If your pic is not scaling right try using draw9patch in android sdk tools folder.

If not, try to play with others scaleType methods.

Upvotes: 1

Android
Android

Reputation: 1427

try this code

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
         android:background="@drawable/ic_launcher">

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:src="@drawable/ic_launcher" />

    </LinearLayout>

Upvotes: 0

Tim
Tim

Reputation: 6712

did you check out the scaleType property? You can set it to center or something else and see if it scales now.

Upvotes: 0

Related Questions