【问题标题】:How to combine text and image button in android? [duplicate]如何在android中组合文本和图像按钮? [复制]
【发布时间】:2016-05-22 01:18:40
【问题描述】:

我想用这样的文字和图像制作按钮

【问题讨论】:

  • 检查this
  • 这些看起来像首选项而不是按钮。
  • 看起来像一个TextView,左边有一个compound drawable

标签: android button


【解决方案1】:

你应该使用 drawable_left 。像这样将您的图标分配给您的小部件:

<Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:drawableLeft="@drawable/your_drawable"
            android:text="@string/your_text" />

【讨论】:

    【解决方案2】:

    看看这个

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:color/black"
        android:drawableLeft="@mipmap/ic_launcher"
        android:textColor="#FFFFFF"
        android:paddingLeft="10sp"
        android:drawablePadding="5sp"
        android:padding="10dp"
        android:text="Button">
    </Button>
    

    Button

    请看下面的链接

    http://i.stack.imgur.com/SZyLl.png

    【讨论】:

      猜你喜欢
      • 2013-09-29
      • 1970-01-01
      • 1970-01-01
      • 2020-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      • 2012-09-03
      相关资源
      最近更新 更多