Question: I am trying to create a image button and I want to give the specific width and height to it, but my image size 512 x 512 and when activity starts layout is distorted because of the image.

Is there anyway I can resize it to some specific size? 

```
                   <Button
        android:id="@+id/prev"
        android:text=""
        android:gravity="center"
        android:width="20dp"
        android:height="20dp"
        android:background="@drawable/go_prev"
            />  

```

Answer: 
Yes. Set your layout\_width and layout\_height to numeric values and it will fix the image to that exact size. You can then control how its scaled or cropped vi the scaleType parameter. Be careful specifying dp or px- dp will let you specify it in 160ths of an inch, px will be phyiscal pixels (but may be any real world size).
You can specify the size in `px` which will be physical pixels instead of `dp` (Density-independent pixel); **However**, you should **not** do this if your app should support multiple screens.

Also, consider using `android:layout_height` and `android:layout_width` instead of `height` and `width`