本文整理汇总了Java中android.widget.ImageButton.setSelected方法的典型用法代码示例。如果您正苦于以下问题:Java ImageButton.setSelected方法的具体用法?Java ImageButton.setSelected怎么用?Java ImageButton.setSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageButton
的用法示例。
在下文中一共展示了ImageButton.setSelected方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if(styleManager.getItemViewType(position) == BottomStyleManager.ITEM_EMOJ) {
ImageButton image = (ImageButton) holder.itemView;
EmojiStyleWrapper wrapper = mEmojiStyleWrapperManager.getStyleWrapperByStyleItem(position);
int resourceId = wrapper.getStyleIcon();
if (resourceId > 0) {
image.setImageResource(resourceId);
}
if (wrapper.isSelected()) {
image.setSelected(true);
} else {
image.setSelected(false);
}
holder.itemView.setOnClickListener(new ItemClick(holder, position));
}else {
View.OnClickListener clickListener = (View.OnClickListener) holder.itemView.getTag(R.id.bottom_item_click);
if(clickListener != null) {
holder.itemView.setOnClickListener(clickListener);
}
}
}
示例2: setBookmarkState
import android.widget.ImageButton; //导入方法依赖的package包/类
@Override
public void setBookmarkState(boolean Checked) {
if (is_nav_view_inflated) {
ImageButton bookmarkImageButton = mControlsView.findViewById(R.id.action_bookmark_this_page);
if (bookmarkImageButton.isSelected() != Checked)
bookmarkImageButton.setSelected(Checked);
}
}
示例3: initGenderButton
import android.widget.ImageButton; //导入方法依赖的package包/类
private ImageButton initGenderButton(final String gender, int buttonId) {
boolean selected = gender.equals(mSpecimen.gender);
ImageButton button = (ImageButton) findViewById(buttonId);
button.setEnabled(mEditMode);
button.setSelected(selected);
updateGenderIconFilter(button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (v.isSelected()) {
//Deselect existing
deselectAllGenderButtons();
mSpecimen.gender = null;
} else {
//Select this one
deselectAllGenderButtons();
v.setSelected(true);
mSpecimen.gender = gender;
}
updateGenderIconFilter((ImageButton) v);
}
});
return button;
}
示例4: setButtonSelected
import android.widget.ImageButton; //导入方法依赖的package包/类
protected void setButtonSelected(ImageButton b, boolean isSelected)
{
b.setSelected(isSelected);
ViewUtils.setImageButtonColorAttr(getContext(), b,
b.isSelected() ? R.attr.colorAccent : R.attr.colorDialogContent);
}