Bilbo Baggins
Bilbo Baggins

Reputation: 3692

Android: Stretch bitmap to fill entire screen

I'm using a bitmap as a background for activity. The code of the custom background is:

<item>
<bitmap android:src="@drawable/fog"
        android:layout_width="match_parent"
        android:adjustViewBounds="true"
             />
</item>

However it sits in the middle and doesn't occupy the entire screen space. How can I make it fill all the available space? I tried setting width and height to fill_parent.

Thanks

Upvotes: 3

Views: 2899

Answers (3)

JRowan
JRowan

Reputation: 7104

android:scaleType="fitXY" is what i use to fill imageviews, i never had bitmap as item, theres cropping ones too

Upvotes: 0

alistair
alistair

Reputation: 1172

I agree with the @androidz post. To avoid distortion, you can use the setAdjustViewBounds function (see here).

Upvotes: 1

Androidz
Androidz

Reputation: 401

try adding:

android:layout_width="match_parent"

android:layout_height="match_parent"

Upvotes: 1

Related Questions