简体   繁体   English

Android /样式按钮:背景也在Drawable left和Drawable right后面

[英]Android / Styling a Button: Background also behind Drawable left and Drawable right

I am styling a Button whose width can change in the program through different Content. 我正在设计一个Button,其宽度可以通过不同的Content在程序中更改。 I got the png files from the designer like this: 我从设计师那里得到了png文件,如下所示:

[Left Border] [Background (just a strip with the gradient)] [Right Border]

I thought I'm fine with assigning the Properties of the Button like this: 我以为我可以像这样分配Button的属性:

Background: Background.png
Drawable left: LeftBorder.png
Drawable right: RightBorder.png

BUT it shall not be like that ;) Right now the Background.png begins where the Drawable Left begins and ends at the end of Drawable Right. 但是它不应该那样;)现在,Background.png从Drawable Left的开始处开始,并在Drawable Right的末尾结束。 Is using those Drawable Properties not the right way in this case? 在这种情况下,使用那些Drawable属性不是正确的方法吗?

Here is the Code: 这是代码:

<Button
  android:text="@+id/Button01"
  android:id="@+id/Button01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:drawableLeft="@drawable/top_loaction_left"
  android:drawableRight="@drawable/top_loaction_right"
  android:background="@drawable/top_loaction_bg"></Button>

.. ..

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

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