【问题标题】:Android / Styling a Button: Background also behind Drawable left and Drawable rightAndroid /样式化按钮:背景也在Drawable left和Drawable right后面
【发布时间】:2010-09-15 15:49:01
【问题描述】:

我正在设计一个按钮,其宽度可以通过不同的内容在程序中改变。我从设计师那里得到了这样的 png 文件:

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

我认为我可以像这样分配按钮的属性:

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

但它不应该那样;) 现在 Background.png 从 Drawable Left 开始的地方开始,并在 Drawable Right 的末尾结束。在这种情况下使用那些 Drawable 属性不是正确的方法吗?

代码如下:

<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>

..

【问题讨论】:

    标签: android button android-layout nine-patch android-xml


    【解决方案1】:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-06
    • 2021-06-03
    相关资源
    最近更新 更多