Android – how to align images in image buttons

I want to place my image in the assigned image button view. But it's not fixed in that space. It looks strange! Can I align the image with the allocated space of the image button, or do I have to crop and set it?

resolvent:

The image in the imagebutton tag is aligned to the left

<ImageButton 
    android:id="@+id/sample"
    android:layout_gravity="left"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:scaleType="fitStart" 
    android:src="@drawable/sample" >
</ImageButton>

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>