michael
michael

Reputation: 110670

Size of ImageView

I have a png which is 72 x 72 (I get this info when I view properties on that image under Mac). I put that image in an ImageView using layout_width/layout_height as 'wrap_content'.

But when I compare that with another ImageView which I specified as '96dp' in both layout_width/layout_height. That png imageView is bigger.

Can anyone please tell me how can I resize my 72x72 png so that it looks as big as 96dp x 96dp under android.

Upvotes: 2

Views: 485

Answers (2)

FunkTheMonk
FunkTheMonk

Reputation: 10938

Check out the documentation on providing resources. Resources you put in res/drawable assume they are the resources for a medium density device, and will be scaled up and down to suit the device that runs the app. You could supply a 96x96 resource in the res/drawable-hdpi folder, or put the 76x76 resource in res/drawable-nodpi.

But I'm not really clear on what you want. Sounds like you want to know how to resize the image using software on your desktop so the image is 96x96 instead of 76x76? Not a Mac user, so not sure what programs are available by default.

Upvotes: 2

benbeel
benbeel

Reputation: 1542

if you are asking to make your image 96x96, then set the size explicitly in your imageview XML:

 android:layout_width="96dp"
 android:layout_height="96dp"

of course, bear in mind that the image may not scale up perfectly, so you may want to run it through some image processing software first to make it look perdy

Upvotes: 0

Related Questions