开发者

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:sm开发者_开发问答allScreens="true"
      android:anyDensity="true"
      />

Why don't the background images scale correctly?


You can use ImageView.ScaleType

ImageView.ScaleType="CENTER_CROP"


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜