本文整理了Java中android.widget.ImageButton.getResources()
方法的一些代码示例,展示了ImageButton.getResources()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.getResources()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:getResources
暂无
代码示例来源:origin: ankidroid/Anki-Android
private void setDeckExpander(ImageButton expander, ImageButton indent, Sched.DeckDueTreeNode node){
boolean collapsed = mCol.getDecks().get(node.did).optBoolean("collapsed", false);
// Apply the correct expand/collapse drawable
if (collapsed) {
expander.setImageDrawable(mExpandImage);
expander.setContentDescription(expander.getContext().getString(R.string.expand));
} else if (node.children.size() > 0) {
expander.setImageDrawable(mCollapseImage);
expander.setContentDescription(expander.getContext().getString(R.string.collapse));
} else {
expander.setImageDrawable(mNoExpander);
}
// Add some indenting for each nested level
int width = (int) indent.getResources().getDimension(R.dimen.keyline_1) * node.depth;
indent.setMinimumWidth(width);
}
代码示例来源:origin: stackoverflow.com
public static void tintButton(@NonNull ImageButton button) {
ColorStateList colours = button.getResources()
.getColorStateList(R.color.button_colour);
Drawable d = DrawableCompat.wrap(button.getDrawable());
DrawableCompat.setTintList(d, colours);
button.setImageDrawable(d);
}
内容来源于网络,如有侵权,请联系作者删除!