更改图像浮动操作按钮的Andr​​oid [英] Change image Floating Action Button Android

查看:153
本文介绍了更改图像浮动操作按钮的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这个库 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);

这篇关于更改图像浮动操作按钮的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆