更改图像浮动操作按钮的Android [英] Change image Floating Action Button Android
问题描述
我用这个库 https://github.com/futuresimple/android-floating-动作按钮。如何更改主按钮的形象?我要选择较小的一个按钮后立即更改按钮图像。
I used this library https://github.com/futuresimple/android-floating-action-button. How can I change the image of the main button? I want to change the button image right after selecting one of the smaller buttons.
推荐答案
从<一个href=\"https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html\" rel=\"nofollow\">https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html
由于这一类从ImageView的下降,你可以控制它的图标
通过setImageDrawable(绘制对象)被显示出来。
As this class descends from ImageView, you can control the icon which is displayed via setImageDrawable(Drawable).
或者你可以使用setImageResource():
Or you can use setImageResource():
fab.setImageResource(R.drawable.ic_shopping_cart_white);
这篇关于更改图像浮动操作按钮的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!