简体   繁体   English

具有可绘制背景和可绘制左侧的样式按钮

[英]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.如果你想让整个东西都可以点击,你只需要在你的 PC 上的 Paint 程序中更改图片,然后将正确的图片更改为你制作的新图片。

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).尝试在图像上使用 ImageButton 并将其分解为 2 个差异按钮(按钮和图像按钮),或者仅使用 PC 上的 Paint 程序并将图像放在 ImageButton 背景上(我认为第二个更容易)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM