In Android, how to place image at center on a button without stretching? -


in android layout file, have button. , want present image button without text. problem have is, image stretched cover whole button area. instead of stretching, i'd have button placed @ center of button without distortion image.

<button     android:layout_width="38dp"     android:layout_height="match_parent"     android:background="@drawable/icon_more"     android:id="@+id/button"     android:layout_alignparenttop="true"     android:layout_alignparentend="true" /> 

right now, looks this:

enter image description here

it's horizontally stretched, not want.

using imagebutton choice you. can try:

    <imagebutton         android:layout_width="38dp"         android:layout_height="match_parent"         android:src="@drawable/icon_more"         android:scaletype="centerinside"         /> 

flexibly combining attributes layout_width, layout_height , scaletype helps ui


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -