如果使用基于矢量的drawable,结合 ImageView ,样式和颜色状态列表,您的按钮可以重构如下:
Note: 矢量drawables明显小于图像,所以额外的,明确的定义不应该避免手动修改矢量资产,我宁愿处理更新几个文件的开销,而不是在一个文件上进行转换):
Note: Android Studio是矢量资产的绝佳来源 .
res\values\styles.xml
match_parent
match_parent
@color/button_csl
res\color\button_csl.xml
details_menu_large_button.xml
android:drawable="@drawable/and_card_details_button_down_left_onclick" />
Details_Buttons_Top_Left_Button
style="@style/Details_Buttons_Top_Left_Button"
android:src="@drawable/details_menu_large_button" />
and_card_details_button_down_left.xml (ic_play_arrow_black_24dp.xml)
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
android:fillColor="#FF000000"
android:pathData="M8,5v14l11,-7z"/>
and_card_details_button_down_left_onclick.xml (修改了ic_play_arrow_black_24dp.xml)
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
android:pivotX="12"
android:pivotY="12"
android:rotation="90" >
android:fillColor="#FF000000"
android:pathData="M8,5v14l11,-7z"/>