android - Custom Button Image width and height in XML -


i have following implementation, , please see following image, , in first button (id:button3) not fit button, or button size big custom image. wonder how fix issue.

<linearlayout         android:layout_width="wrap_content"         android:layout_height="44dp"         android:id="@+id/view3"         android:background="#000000"         android:layout_alignparentright="true">         <button             android:layout_width="48dip"             android:layout_height="39dip"             android:id="@+id/button3"             android:drawableright="@drawable/undo_button" />         <button             android:text="button"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:id="@+id/button2" />         <button            android:text="button"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/button1" /> </linearlayout> 

if want force undo_button drawable scale nicely, use imagebutton instead.

try this:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="wrap_content"     android:layout_height="44dp"     android:id="@+id/view3"     android:background="#000000"     android:layout_alignparentright="true">     <imagebutton         android:layout_width="48dip"         android:layout_height="39dip"         android:id="@+id/button3"         android:src="@drawable/undo_button"         android:scaletype="fitcenter"/>     <button         android:text="button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/button2" />     <button         android:text="button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/button1" /> </linearlayout> 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -