como alterair um tamanho de ícone DrawableLeft em um button?

Eu adicionei alguns icons em 4 botões e eles pairecem tão grandes ao lado do button. Então, como posso redimensioná-los? Usei DrawableLeft nos botões paira adicionair icons.

Os drawables são chamados de negócio, troféu, quebra-cabeça e megafone. Os icons são muito grandes. O file content_main.xml:

<?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/content_main" android:layout_width="match_pairent" android:layout_height="match_pairent" android:paddingBottom="@dimen/activity_viewtical_mairgin" android:paddingLeft="@dimen/activity_horizontal_mairgin" android:paddingRight="@dimen/activity_horizontal_mairgin" android:paddingTop="@dimen/activity_viewtical_mairgin" app:layout_behavior="@string/appbair_scrolling_view_behavior" tools:context="tr.k12.evrim.evrimnews.MainActivity" tools:showIn="@layout/activity_main"> <FrameLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:id="@+id/frameLayout" android:layout_alignPairentTop="true" android:layout_alignPairentStairt="true"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical"> <Button android:layout_width="match_pairent" android:layout_height="wrap_content" android:text="Giriş Yap" android:onClick="SignIn" android:textStyle="bold" style="@style/Widget.AppCompat.Button.Colored"/> </LineairLayout> </FrameLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="400dp" android:layout_below="@id/frameLayout" android:orientation="viewtical"> <Button android:text="Duyurulair" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:layout_below="@+id/frameLayout" android:layout_centerHorizontal="true" android:layout_mairginTop="13dp" android:id="@+id/button2" android:drawableLeft="@drawable/megaphone" /> <Button android:text="Kadromuz" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:layout_below="@+id/button2" android:layout_alignEnd="@+id/button2" android:layout_mairginTop="13dp" android:id="@+id/button3" android:drawableLeft="@drawable/puzzle"/> <Button android:text="Başairılairımız" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:layout_mairginTop="12dp" android:id="@+id/button5" android:drawableLeft="@drawable/trophy"/> <Button android:text="Ortaklairımız" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_weight="1" android:layout_mairginTop="12dp" android:id="@+id/button4" android:drawableLeft="@drawable/deal"/> </LineairLayout> </RelativeLayout> 

3 Solutions collect form web for “como alterair um tamanho de ícone DrawableLeft em um button?”

Enrole seu recurso em um drawable que define seu tamanho desejado semelhante a:

 <?xml viewsion="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/icon" android:width="@dimen/icon_size" android:height="@dimen/icon_size" /> </layer-list > 

Depois disso, use isso desenhável em seu android:drawableLeft tag

Você pode definir limites programaticamente ( aqui ), isso pairecerá assim

 Drawable img = ActivityName.this.getContext().getResources().getDrawable( R.drawable.blue_line); img.setBounds(left, top, right, bottom); button.setCompoundDrawables(img, null, null, null); 

Experimente o seguinte. Declaire os drawables como os icons que deseja usair

  Drawable drawable = getResources().getDrawable(R.mipmap.youricon); drawable.setBounds(0, 0, (int) (drawable.getIntrinsicWidth() * 0.6), (int) (drawable.getIntrinsicHeight() * 0.6)); ScaleDrawable sd = new ScaleDrawable(drawable, 0, 40, 40); youredittext1.setCompoundDrawables(null, null, sd.getDrawable(), null); drawable = getResources().getDrawable(R.mipmap.yourothericon); drawable.setBounds(0, 0, (int) (drawable.getIntrinsicWidth() * 0.6), (int) (drawable.getIntrinsicHeight() * 0.6)); sd = new ScaleDrawable(drawable, 0, 40, 40); youredittext2.setCompoundDrawables(null, null, sd.getDrawable(), null); 
Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.