当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Styling button with drawable background and drawable left

问题描述:

I suspect I'm going to have to do this the hard way, but here goes

I have this:

 <Button

android:id="@+id/favouritesButton"

android:layout_height="wrap_content"

android:layout_margin="5sp"

android:text="@string/favourites"

android:drawableLeft="@drawable/shopping_basket_90x75"

android:enabled="false"

style="@style/BtnBigGreenLeft" />

Which gives me this

What the client wants is this (different drawable image but you get the idea)

Is this possible, or do I have to break it out into separate elements to get it to work?

网友答案:

Yea just break it down. It will solve you many future problems with any other solution.

And make the Linear layout the wraps it all clickable.

网友答案:

Sorry for my english.

If you want that all the picture will be clickable you can fix it simply

but if you want that only the green area will be clickable it should be harder

网友答案:

Sorry for my english again.

if you want whole thing clickable you only should to change the picture in the Paint program on your PC and change the correct pic to the new pic that you made and that it.

I hope it will halp you.

网友答案:

I think that you cant do this in one button.

Try to use the ImageButton on the image and break it down to 2 diference buttons(button and imagebutton) or just use the Paint program on your PC and put the image on the ImageButton background (the second I think easyer).

分享给朋友:
您可能感兴趣的文章:
随机阅读: