本文整理了Java中android.widget.ImageButton.setSelected()
方法的一些代码示例,展示了ImageButton.setSelected()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.setSelected()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:setSelected
暂无
代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher
/**
* Adapts the selection state of a tab's views.
*
* @param tabItem
* The tab item, which corresponds to the tab, whose selection state should be adapted,
* as an instance of the class {@link TabItem}. The tab item may not be null
*/
private void adaptSelectionState(@NonNull final TabItem tabItem) {
boolean selected = model.getSelectedTab() == tabItem.getTab();
tabItem.getView().setSelected(selected);
AbstractTabViewHolder viewHolder = tabItem.getViewHolder();
viewHolder.titleTextView.setSelected(selected);
viewHolder.closeButton.setSelected(selected);
}
代码示例来源:origin: icechen1/Notable
public void resetBkg(){
checkmarkGray.setSelected(false);
checkmarkGreen.setSelected(false);
checkmarkOrange.setSelected(false);
checkmarkRed.setSelected(false);
}
代码示例来源:origin: saki4510t/libcommon
/**
* フレーム種を選択する…今は何も起こらんと思う, 選択したフレーム種のImageButtonを#setSelected(true)にするだけ
* @param frame_type
*/
public void setFrameType(final int frame_type) {
if ((frame_type > 0) && (frame_type < FrameView.FRAME_TYPE_NUMS)) {
for (int i = 0; i < FrameView.FRAME_TYPE_NUMS - 1; i++) {
mFrameButtons[i].setSelected(false);
}
mFrameButtons[frame_type-1].setSelected(true);
}
}
代码示例来源:origin: Catrobat/Paintroid
private void resetDrawTypeActivated() {
fillButton.setSelected(false);
outlineButton.setSelected(false);
}
代码示例来源:origin: Catrobat/Paintroid
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.pocketpaint_stroke_ibtn_circle) {
updateStrokeCap(Cap.ROUND);
buttonCircle.setSelected(true);
buttonRect.setSelected(false);
} else if (i == R.id.pocketpaint_stroke_ibtn_rect) {
updateStrokeCap(Cap.SQUARE);
buttonRect.setSelected(true);
buttonCircle.setSelected(false);
}
drawerPreview.invalidate();
}
代码示例来源:origin: Catrobat/Paintroid
public void setCurrentPaint(Paint currentPaint) {
if (currentPaint.getStrokeCap() == Cap.ROUND) {
buttonCircle.setSelected(true);
buttonRect.setSelected(false);
} else {
buttonCircle.setSelected(false);
buttonRect.setSelected(true);
}
brushWidthSeekBar.setProgress((int) currentPaint.getStrokeWidth());
brushSizeText.setText(String.format(Locale.getDefault(), "%d", (int) currentPaint.getStrokeWidth()));
}
代码示例来源:origin: stackoverflow.com
final ImageButton btnTest =(ImageButton) findViewById(R.id.btnexctract);
btnTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btnTest.setSelected(!btnextra.isPressed());
if (btnTest.isPressed()) {
btnextra.setImageResource(R.drawable.yourImage);
}
else {
btnTest.setImageResource(R.drawable.yourImage2);
}
}
});
代码示例来源:origin: guofudong/EShop
@Override
protected void onBusinessResponse(String apiPath, boolean success, ResponseEntity rsp) {
if (!ApiPath.COLLECT_CREATE.equals(apiPath)) {
throw new UnsupportedOperationException(apiPath);
}
mProgressWrapper.dismissProgress();
if (success) {
btnFavorite.setSelected(true);
}
}
代码示例来源:origin: stackoverflow.com
final ImageButton ib = (ImageButton) value.findViewById(R.id.imageButton);
OnClickListener ocl =new OnClickListener() {
@Override
public void onClick(View button) {
if (button.isSelected()){
button.setSelected(false);
} else {
ib.setSelected(false);
//put all the other buttons you might want to disable here...
button.setSelected(true);
}
}
};
ib.setOnClickListener(ocl);
//add ocl to all the other buttons
代码示例来源:origin: stackoverflow.com
final ImageButton ib = (ImageButton) value.findViewById(R.id.imageButton);
OnClickListener ocl =new OnClickListener() {
@Override
public void onClick(View button) {
if (button.isSelected()){
button.setSelected(false);
} else {
ib.setSelected(false);
//put all the other buttons you might want to disable here...
button.setSelected(true);
}
}
};
ib.setOnClickListener(ocl);
//add ocl to all the other buttons
代码示例来源:origin: icechen1/Notable
@Click
void checkmark_gray(){
resetBkg();
checkmarkGray.setSelected(true);
icon = NotificationItem.CHECKMARK_GRAY;
}
代码示例来源:origin: icechen1/Notable
@Click
void checkmark_orange(){
resetBkg();
checkmarkOrange.setSelected(true);
icon= NotificationItem.CHECKMARK_ORANGE;
}
@Click
代码示例来源:origin: vipulasri/Artisto_capstone
@Override
public void onClick(View v) {
if(mCallbacks!=null) {
artViewHolder.mFavoriteButton.setSelected(!artwork.isFavorite());
mCallbacks.onFavoriteClick(artwork);
}
}
});
代码示例来源:origin: vipulasri/Artisto_capstone
@Override
public void onClick(View v) {
if(mCallbacks!=null) {
artViewHolder.mFavoriteButton.setSelected(!artwork.isFavorite());
mCallbacks.onFavoriteClick(artwork);
}
}
});
代码示例来源:origin: icechen1/Notable
@Click
void checkmark_green(){
resetBkg();
checkmarkGreen.setSelected(true);
icon= NotificationItem.CHECKMARK_GREEN;
}
@Click
代码示例来源:origin: icechen1/Notable
@Click
void checkmark_red(){
resetBkg();
checkmarkRed.setSelected(true);
icon= NotificationItem.CHECKMARK_RED;
}
代码示例来源:origin: 123ufo/DWImageSelector
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
ImageEntity entity = mList.get(position);
Log.d(TAG, "onBindViewHolder:--> Position: "+position + "check: "+ entity.isSelect());
holder.ibSelect.setSelected(entity.isSelect());
holder.ivImage.getLayoutParams().width = itemSize;
holder.ivImage.getLayoutParams().height = itemSize;
holder.ivImage.setImageResource(R.color.colorLine);
ImageLoader.getInstance().loadImage(entity.getPath(),holder.ivImage);
}
}
代码示例来源:origin: adafruit/Bluefruit_LE_Connect_Android
public void onClickNotifyCharacteristic(View view) {
ElementPath elementPath = (ElementPath) view.getTag();
if (elementPath != null) {
// Check if is a characteristic
if (elementPath.characteristicUUID != null && elementPath.descriptorUUID == null) {
BluetoothGattService service = mBleManager.getGattService(elementPath.serviceUUID, elementPath.serviceInstance);
if (mBleManager.isCharacteristicNotifiable(service, elementPath.characteristicUUID)) {
Log.d(TAG, "Notify char");
ImageButton imageButton = (ImageButton) view;
final boolean selected = !imageButton.isSelected();
imageButton.setSelected(selected);
mBleManager.enableNotification(service, elementPath.characteristicUUID, selected);
// Button color effect when pressed
imageButton.setImageResource(selected ? R.drawable.ic_sync_white_24dp : R.drawable.ic_sync_black_24dp);
}
}
}
}
代码示例来源:origin: derry/delion
@Override
public void onDismiss() {
if (mPopup.getAnchorView() instanceof ImageButton) {
((ImageButton) mPopup.getAnchorView()).setSelected(false);
}
if (mMenuItemEnterAnimator != null) mMenuItemEnterAnimator.cancel();
mHandler.appMenuDismissed();
mHandler.onMenuVisibilityChanged(false);
}
});
代码示例来源:origin: mkulesh/microMathematics
protected void setButtonSelected(ImageButton b, boolean isSelected)
{
b.setSelected(isSelected);
if (b.isSelected())
{
b.setBackgroundResource(R.drawable.formula_term_border);
CompatUtils.setDrawableColorAttr(getContext(), b.getBackground(), R.attr.colorAccent);
}
else
{
b.setBackgroundResource(android.R.color.transparent);
}
ViewUtils.setImageButtonColorAttr(getContext(), b,
b.isSelected() ? R.attr.colorAccent : R.attr.colorDialogContent);
}
内容来源于网络,如有侵权,请联系作者删除!