mayur
mayur

Reputation: 11

Scale images according to device

I have developed an Android game using a Canvas. When I port the game on devices with different resolutions, the graphics, such as ImageButtons, get scaled according to resolution, but the background images do not scale appropriately.

I have written these lines in manifest file :

<supports-screens
      android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true"
      android:anyDensity="true"
      />

Why don't the background images scale correctly?

Upvotes: 0

Views: 556

Answers (2)

Hanry
Hanry

Reputation: 5531

You can use ImageView.ScaleType

ImageView.ScaleType="CENTER_CROP"

Upvotes: 1

Joel
Joel

Reputation: 3454

Try to use an ImageView that will most likely scale automatically. At least it did in my program. It's worth a try.

Upvotes: 0

Related Questions