Android Button Drawable Tint

前端 未结 7 1644
自闭症患者
自闭症患者 2020-12-04 18:13

Is it possible to tint the drawableLeft in an android button? I have a black drawable I\'d like to tint white. I know how to achieve this with an image view (image on the le

7条回答
  •  没有蜡笔的小新
    2020-12-04 18:17

    You can achieve coloring the drawableleft on a button with this method:

    Step 1: Create a drawable resource file with bitmap as parent element as shown below and name it as ic_action_landscape.xml under the drawable folder

    
    
    

    Step 2: Create your Button control in your layout as below

    The button gets the drawable from the ic_action_landscape.xml from the drawable folder instead of @android:drawable or drawable png(s).

    Method 2:
    Step 1:
    You can even add the icon as a Action Bar and Tab icons with Foreground as Image that can be imported from a custom location or a Clipart

    Step 2:
    Under Theme dropdown select Custom

    Step 3:
    Then select the color as #FFFFFF in the Foreground color selection. Method 2 Pictorial representation

    Finally finish the wizard to add the image, then add the drawable as an image.

    Pictorial representation for answer to the question

提交回复
热议问题