【发布时间】:2017-03-06 11:03:52
【问题描述】:
我为ToggleButtons 创建了一个drawable,但我还需要显示一个图标。
如果只有背景属性,我该怎么做?
这是ToggleButton 可绘制对象:
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" />
<stroke android:color="#CED2D4" android:width="1dp" />
<solid android:color="#EDEEEF"/>
</shape>
以及放置ToggleButton 的代码(当前使用IconFont,但我必须更改,因为项目是动态的):
<ToggleButton
android:id="@+id/toggleCreditCard"
android:layout_width="@dimen/width_filter_facilities_button"
android:layout_height="@dimen/height_filter_facilities_button"
android:background="@drawable/filter_service_toggle_default"
android:textOff="@string/fa_credit_card"
android:textOn="@string/fa_credit_card" />
【问题讨论】:
标签: android