android.widget.ImageView.setSelected()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中android.widget.ImageView.setSelected()方法的一些代码示例,展示了ImageView.setSelected()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setSelected()方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setSelected

ImageView.setSelected介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

private void setImageButtons(int currentTheme) {
  mCards[0].setSelected(currentTheme == ThemeHelper.CARD_SAKURA);
  mCards[1].setSelected(currentTheme == ThemeHelper.CARD_HOPE);
  mCards[2].setSelected(currentTheme == ThemeHelper.CARD_STORM);
  mCards[3].setSelected(currentTheme == ThemeHelper.CARD_WOOD);
  mCards[4].setSelected(currentTheme == ThemeHelper.CARD_LIGHT);
  mCards[5].setSelected(currentTheme == ThemeHelper.CARD_THUNDER);
  mCards[6].setSelected(currentTheme == ThemeHelper.CARD_SAND);
  mCards[7].setSelected(currentTheme == ThemeHelper.CARD_FIREY);
}

代码示例来源:origin: aa112901/remusic

private void switchTabs(int position) {
  for (int i = 0; i < tabs.size(); i++) {
    if (position == i) {
      tabs.get(i).setSelected(true);
    } else {
      tabs.get(i).setSelected(false);
    }
  }
}

代码示例来源:origin: Rukey7/MvpApp

@Override
  public void onPageSelected(int position) {
    mCurPosition = position;
    // 设置图标状态
    mIvFavorite.setSelected(mAdapter.isLoved(position));
    mIvDownload.setSelected(mAdapter.isDownload(position));
    mIvPraise.setSelected(mAdapter.isPraise(position));
  }
});

代码示例来源:origin: jaydenxiao2016/AndroidFire

dotViews[i].setSelected(true);
} else {
  dotViews[i].setSelected(false);

代码示例来源:origin: Rukey7/MvpApp

/**
 * 显示/隐藏弹幕
 *
 * @param isShow 是否显示
 * @return
 */
public IjkPlayerView showOrHideDanmaku(boolean isShow) {
  if (isShow) {
    mIvDanmakuControl.setSelected(false);
    mDanmakuView.show();
  } else {
    mIvDanmakuControl.setSelected(true);
    mDanmakuView.hide();
  }
  return this;
}

代码示例来源:origin: Rukey7/MvpApp

@Override
public void loadData(List<BeautyPhotoInfo> data) {
  mAdapter.updateData(data);
  mVpPhoto.setCurrentItem(mIndex);
  if (mIndex == 0) {
    // 为 0 不会回调 addOnPageChangeListener,所以这里要处理下
    mIvFavorite.setSelected(mAdapter.isLoved(0));
    mIvDownload.setSelected(mAdapter.isDownload(0));
    mIvPraise.setSelected(mAdapter.isPraise(0));
  }
}

代码示例来源:origin: stackoverflow.com

tabIconView.setSelected(true);

代码示例来源:origin: Rukey7/MvpApp

@Override
  public void onClick(DialogInterface dialog, int which) {
    DownloaderWrapper.start(mVideoData);
    mIvVideoDownload.setSelected(true);
    SnackbarUtils.showDownloadSnackbar(VideoPlayerActivity.this, "任务正在下载", true);
  }
});

代码示例来源:origin: jaydenxiao2016/AndroidFire

/**
 * 初始化标识点
 *
 * @param length
 */
public void initDots(int length) {
  if (dotlayout == null)
    return;
  dotlayout.removeAllViews();
  LinearLayout.LayoutParams mParams = new LinearLayout.LayoutParams(dip2px(context, dotsize), dip2px(context, dotsize));
  mParams.setMargins(dip2px(context, dotoffset), 0, dip2px(context, dotoffset), 0);//设置小圆点左右之间的间隔
  dotViews = new ImageView[length];
  for (int i = 0; i < length; i++) {
    ImageView imageView = new ImageView(context);
    imageView.setLayoutParams(mParams);
    imageView.setImageResource(R.drawable.dot_selector);
    if (i == 0) {
      imageView.setSelected(true);//默认启动时,选中第一个小圆点
    } else {
      imageView.setSelected(false);
    }
    dotViews[i] = imageView;//得到每个小圆点的引用,用于滑动页面时,(onPageSelected方法中)更改它们的状态。
    dotlayout.addView(imageView);//添加到布局里面显示
  }
}

代码示例来源:origin: Rukey7/MvpApp

/**
 * 暂停
 */
public void pause() {
  mIvPlay.setSelected(false);
  if (mVideoView.isPlaying()) {
    mVideoView.pause();
  }
  _pauseDanmaku();
  // 视频暂停时关闭屏幕常亮
  mAttachActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}

代码示例来源:origin: Rukey7/MvpApp

/**
 * Activity.onPause() 里调用
 */
public void onPause() {
  Log.i("TTAG", "onPause");
  mCurPosition = mVideoView.getCurrentPosition();
  mVideoView.pause();
  mIvPlay.setSelected(false);
  mOrientationListener.disable();
  _pauseDanmaku();
}

代码示例来源:origin: Rukey7/MvpApp

@Override
public void loadData(VideoInfo data) {
  mVideoData = data;
  mIvVideoCollect.setChecked(data.isCollect());
  mIvVideoDownload.setSelected(data.getDownloadStatus() != DownloadStatus.NORMAL);
}

代码示例来源:origin: jiajunhui/PlayerBase

@Override
public void onPlayerEvent(int eventCode, Bundle bundle) {
  switch (eventCode){
    case OnPlayerEventListener.PLAYER_EVENT_ON_DATA_SOURCE_SET:
      mBufferPercentage = 0;
      mTimeFormat = null;
      updateUI(0, 0);
      setBottomSeekBarState(true);
      DataSource data = (DataSource) bundle.getSerializable(EventKey.SERIALIZABLE_DATA);
      getGroupValue().putObject(DataInter.Key.KEY_DATA_SOURCE, data);
      setTitle(data);
      break;
    case OnPlayerEventListener.PLAYER_EVENT_ON_STATUS_CHANGE:
      int status = bundle.getInt(EventKey.INT_DATA);
      if(status== IPlayer.STATE_PAUSED){
        mStateIcon.setSelected(true);
      }else if(status==IPlayer.STATE_STARTED){
        mStateIcon.setSelected(false);
      }
      break;
    case OnPlayerEventListener.PLAYER_EVENT_ON_VIDEO_RENDER_START:
    case OnPlayerEventListener.PLAYER_EVENT_ON_SEEK_COMPLETE:
      mTimerUpdateProgressEnable = true;
      break;
  }
}

代码示例来源:origin: Rukey7/MvpApp

/**
 * 切换控制锁
 */
private void _togglePlayerLock() {
  mIsForbidTouch = !mIsForbidTouch;
  mIvPlayerLock.setSelected(mIsForbidTouch);
  if (mIsForbidTouch) {
    mOrientationListener.disable();
    _hideAllView(true);
  } else {
    if (!mIsForbidOrientation) {
      mOrientationListener.enable();
    }
    mFullscreenTopBar.setVisibility(View.VISIBLE);
    mLlBottomBar.setVisibility(View.VISIBLE);
    if (mIsEnableDanmaku) {
      mDanmakuPlayerSeek.setVisibility(VISIBLE);
    }
    if (mIsNeedRecoverScreen) {
      mTvRecoverScreen.setVisibility(VISIBLE);
    }
  }
}

代码示例来源:origin: wangdan/AisenWeiBo

public void setLikeView() {
  LikeBean likeBean = DoLikeAction.likeCache.get(data.getId() + "");
  if (btnLike != null) {
    btnLike.setTag(data);
    btnLike.setOnClickListener(this);
    if (likeBean != null && likeBean.isLiked()) {
      imgLike.setSelected(true);
      if (data.getAttitudes_count() > 0)
        txtLike.setText(AisenUtils.getCounter(data.getAttitudes_count(), "+1"));
      else
        txtLike.setText("+1");
    }
    else {
      imgLike.setSelected(false);
      if (data.getAttitudes_count() > 0)
        txtLike.setText(AisenUtils.getCounter(data.getAttitudes_count()) + "");
      else
        txtLike.setText("");
    }
  }
}

代码示例来源:origin: jiajunhui/PlayerBase

@OnClick({
    R.id.cover_player_controller_image_view_back_icon,
    R.id.cover_player_controller_image_view_play_state,
    R.id.cover_player_controller_image_view_switch_screen})
public void onViewClick(View view){
  switch (view.getId()){
    case R.id.cover_player_controller_image_view_back_icon:
      notifyReceiverEvent(DataInter.Event.EVENT_CODE_REQUEST_BACK, null);
      break;
    case R.id.cover_player_controller_image_view_play_state:
      boolean selected = mStateIcon.isSelected();
      if(selected){
        requestResume(null);
      }else{
        requestPause(null);
      }
      mStateIcon.setSelected(!selected);
      break;
    case R.id.cover_player_controller_image_view_switch_screen:
      notifyReceiverEvent(DataInter.Event.EVENT_CODE_REQUEST_TOGGLE_SCREEN, null);
      break;
  }
}

代码示例来源:origin: Rukey7/MvpApp

mIvPlay.setSelected(true);

代码示例来源:origin: aa112901/remusic

customViewPager.setAdapter(customViewPagerAdapter);
customViewPager.setCurrentItem(1);
barmusic.setSelected(true);
customViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
  @Override

代码示例来源:origin: Rukey7/MvpApp

_handleActionBar(isFullscreen);
_changeHeight(isFullscreen);
mIvFullscreen.setSelected(isFullscreen);
mHandler.post(mHideBarRunnable);
mIvMediaQuality.setVisibility(isFullscreen ? VISIBLE : GONE);

代码示例来源:origin: Rukey7/MvpApp

/**
 * 回退,全屏时退回竖屏
 *
 * @return
 */
public boolean onBackPressed() {
  if (recoverFromEditVideo()) {
    return true;
  }
  if (mIsAlwaysFullScreen) {
    _exit();
    return true;
  } else if (mIsFullscreen) {
    mAttachActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    if (mIsForbidTouch) {
      // 锁住状态则解锁
      mIsForbidTouch = false;
      mIvPlayerLock.setSelected(false);
      _setControlBarVisible(mIsShowBar);
    }
    return true;
  }
  return false;
}

相关文章

ImageView类方法