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

x33g5p2x  于2022-01-29 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(350)

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

TextView.setSelected介绍

暂无

代码示例

代码示例来源:origin: TeamNewPipe/NewPipe

private void buildMetadata() {
  metadata = rootView.findViewById(R.id.metadata);
  metadataTitle = rootView.findViewById(R.id.song_name);
  metadataArtist = rootView.findViewById(R.id.artist_name);
  metadata.setOnClickListener(this);
  metadataTitle.setSelected(true);
  metadataArtist.setSelected(true);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
protected View getListHeader() {
  headerRootLayout = activity.getLayoutInflater().inflate(R.layout.local_playlist_header,
      itemsList, false);
  headerTitleView = headerRootLayout.findViewById(R.id.playlist_title_view);
  headerTitleView.setSelected(true);
  headerStreamCount = headerRootLayout.findViewById(R.id.playlist_stream_count);
  playlistControl = headerRootLayout.findViewById(R.id.playlist_control);
  headerPlayAllButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_all_button);
  headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button);
  headerBackgroundButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_bg_button);
  return headerRootLayout;
}

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

/**
 * 处理 VideoEvent,来改变编辑状态UI
 *
 * @param videoEvent
 */
private void _handleVideoEvent(VideoEvent videoEvent) {
  mBtnSelectDel.setEnabled(videoEvent.checkStatus != VideoEvent.CHECK_NONE);
  mBtnSelectAll.setText(videoEvent.checkStatus == VideoEvent.CHECK_ALL ? "取消全选" : "全选");
  mBtnSelectAll.setSelected(videoEvent.checkStatus == VideoEvent.CHECK_ALL);
}

代码示例来源:origin: novoda/android-demos

@Override
public void setSelected(boolean selected) {
  super.setSelected(selected);
  if (selected && listener != null) {
    listener.onSelected();
  }
}

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

@Override
public View getView(final int i, View view, ViewGroup parent) {
  if (view == null) {
    view = LayoutInflater.from(mContext).inflate(R.layout.adapter_media_quality, parent, false);
  }
  TextView qualityDesc = (TextView) view.findViewById(R.id.tv_media_quality);
  qualityDesc.setText(mDatas.get(i).getDesc());
  qualityDesc.setSelected(mDatas.get(i).isSelect());
  return view;
}

代码示例来源:origin: eleme/UETool

@Override
  public void bindView(BriefDescItem briefDescItem) {
    super.bindView(briefDescItem);
    View view = briefDescItem.getElement().getView();
    StringBuilder sb = new StringBuilder();
    sb.append(view.getClass().getName());
    String resName = Util.getResourceName(view.getId());
    if (!TextUtils.isEmpty(resName)) {
      sb.append("@").append(resName);
    }
    vDesc.setText(sb.toString());
    vDesc.setSelected(briefDescItem.isSelected());
  }
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void initViews(View rootView) {
  super.initViews(rootView);
  this.titleTextView = rootView.findViewById(R.id.titleTextView);
  this.channelTextView = rootView.findViewById(R.id.channelTextView);
  this.volumeRelativeLayout = rootView.findViewById(R.id.volumeRelativeLayout);
  this.volumeProgressBar = rootView.findViewById(R.id.volumeProgressBar);
  this.volumeImageView = rootView.findViewById(R.id.volumeImageView);
  this.brightnessRelativeLayout = rootView.findViewById(R.id.brightnessRelativeLayout);
  this.brightnessProgressBar = rootView.findViewById(R.id.brightnessProgressBar);
  this.brightnessImageView = rootView.findViewById(R.id.brightnessImageView);
  this.queueButton = rootView.findViewById(R.id.queueButton);
  this.repeatButton = rootView.findViewById(R.id.repeatButton);
  this.shuffleButton = rootView.findViewById(R.id.shuffleButton);
  this.playPauseButton = rootView.findViewById(R.id.playPauseButton);
  this.playPreviousButton = rootView.findViewById(R.id.playPreviousButton);
  this.playNextButton = rootView.findViewById(R.id.playNextButton);
  this.moreOptionsButton = rootView.findViewById(R.id.moreOptionsButton);
  this.secondaryControls = rootView.findViewById(R.id.secondaryControls);
  this.toggleOrientationButton = rootView.findViewById(R.id.toggleOrientation);
  this.switchBackgroundButton = rootView.findViewById(R.id.switchBackground);
  this.switchPopupButton = rootView.findViewById(R.id.switchPopup);
  this.queueLayout = findViewById(R.id.playQueuePanel);
  this.itemsListCloseButton = findViewById(R.id.playQueueClose);
  this.itemsList = findViewById(R.id.playQueue);
  titleTextView.setSelected(true);
  channelTextView.setSelected(true);
  getRootView().setKeepScreenOn(true);
}

代码示例来源:origin: TeamNewPipe/NewPipe

ViewHolderItem(View view) {
  super(view);
  progress = new ProgressDrawable();
  ViewCompat.setBackground(itemView.findViewById(R.id.item_bkg), progress);
  status = itemView.findViewById(R.id.item_status);
  name = itemView.findViewById(R.id.item_name);
  icon = itemView.findViewById(R.id.item_icon);
  size = itemView.findViewById(R.id.item_size);
  name.setSelected(true);
  ImageView button = itemView.findViewById(R.id.item_more);
  popupMenu = buildPopup(button);
  button.setOnClickListener(v -> showPopupMenu());
  Menu menu = popupMenu.getMenu();
  start = menu.findItem(R.id.start);
  pause = menu.findItem(R.id.pause);
  open = menu.findItem(R.id.open);
  queue = menu.findItem(R.id.queue);
  showError = menu.findItem(R.id.error_message_view);
  delete = menu.findItem(R.id.delete);
  source = menu.findItem(R.id.source);
  checksum = menu.findItem(R.id.checksum);
  itemView.setOnClickListener((v) -> {
    if (item.mission instanceof FinishedMission)
      viewWithFileProvider(item.mission.getDownloadedFile());
  });
}

代码示例来源:origin: TommyLemon/APIJSON

/**选择tab
 * @param position
 * @param tabType
 */
public void select(int position) {
  Log.i(TAG, "select  position = " + position);
  if (position < 0 || position >= getCount()) {
    Log.e(TAG, "select  position < 0 || position >= getCount() >> return;");
    return;
  }
  for (int i = 0; i < tvTabs.length; i++) {
    tvTabs[i].setSelected(i == position);
  }
  
  if (onTabSelectedListener != null) {
    onTabSelectedListener.onTabSelected(tvTabs[position]
        , position, tvTabs[position].getId());
  }
  this.currentPosition = position;
}

代码示例来源:origin: TommyLemon/Android-ZBLibrary

/**选择tab
 * @param position
 * @param tabType
 */
public void select(int position) {
  Log.i(TAG, "select  position = " + position);
  if (position < 0 || position >= getCount()) {
    Log.e(TAG, "select  position < 0 || position >= getCount() >> return;");
    return;
  }
  for (int i = 0; i < tvTabs.length; i++) {
    tvTabs[i].setSelected(i == position);
  }
  if (onTabSelectedListener != null) {
    onTabSelectedListener.onTabSelected(tvTabs[position]
        , position, tvTabs[position].getId());
  }
  this.currentPosition = position;
}

代码示例来源:origin: naman14/Timber

songtitle.setSelected(true);

代码示例来源:origin: TeamNewPipe/NewPipe

uploaderTextView.setText(info.getUploaderName());
  uploaderTextView.setVisibility(View.VISIBLE);
  uploaderTextView.setSelected(true);
} else {
  uploaderTextView.setVisibility(View.GONE);

代码示例来源:origin: wdullaer/MaterialDateTimePicker

mYearView.setSelected(false);
  mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW);
  mCurrentView = viewIndex;
if (mCurrentView != viewIndex) {
  mMonthAndDayView.setSelected(true);
  mYearView.setSelected(false);
  mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW);
  mCurrentView = viewIndex;
if (mCurrentView != viewIndex) {
  mMonthAndDayView.setSelected(false);
  mYearView.setSelected(true);
  mAnimator.setDisplayedChild(YEAR_VIEW);
  mCurrentView = viewIndex;
if (mCurrentView != viewIndex) {
  mMonthAndDayView.setSelected(false);
  mYearView.setSelected(true);
  mAnimator.setDisplayedChild(YEAR_VIEW);
  mCurrentView = viewIndex;

代码示例来源:origin: iSoron/uhabits

if (mCurrentView != viewIndex) {
  mMonthAndDayView.setSelected(true);
  mYearView.setSelected(false);
  mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW);
  mCurrentView = viewIndex;
if (mCurrentView != viewIndex) {
  mMonthAndDayView.setSelected(false);
  mYearView.setSelected(true);
  mAnimator.setDisplayedChild(YEAR_VIEW);
  mCurrentView = viewIndex;

代码示例来源:origin: lygttpod/AndroidCustomView

@Override
  public void onClick(View v) {
    isSelected = !holder.mTextView.isSelected();
    if (isSelected) {
      holder.mTextView.setSelected(true);
      holder.mTextView.setBackgroundResource(R.drawable.tag_checked_bg);
      selectList.add(tagList.get(position));
    } else {
      holder.mTextView.setSelected(false);
      holder.mTextView.setBackgroundResource(R.drawable.tag_normal_bg);
      selectList.remove(tagList.get(position));
    }
  }
});

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

TextView textView = (TextView) this.findViewById(R.id.textview_marquee);  
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setText("General Information... general information... General Information");
textView.setSelected(true);
textView.setSingleLine(true);

代码示例来源:origin: fossasia/pslab-android

private void toggleDigitalMode(WaveConst mode) {
  waveMonSelected = false;
  if (mode == WaveConst.SQUARE) {
    digital_mode = WaveConst.SQUARE;
    pwmSelectedModeImg.setImageResource(R.drawable.ic_square);
    pwmMonSelectMode.setText(getString(R.string.square));
    btnPwmSq2.setEnabled(false);
    btnPwmSq3.setEnabled(false);
    btnPwmSq4.setEnabled(false);
    pwmBtnPhase.setEnabled(false);
  } else {
    digital_mode = WaveConst.PWM;
    pwmSelectedModeImg.setImageResource(R.drawable.ic_pwm_pic);
    pwmMonSelectMode.setText(getString(R.string.text_pwm));
    btnPwmSq2.setEnabled(true);
    btnPwmSq3.setEnabled(true);
    btnPwmSq4.setEnabled(true);
  }
  pwmMonSqr1.setSelected(false);
  pwmMonSqr2.setSelected(false);
  pwmMonSqr3.setSelected(false);
  pwmMonSqr4.setSelected(false);
  WaveGeneratorCommon.mode_selected = mode;
  selectBtn(WaveConst.SQR1);
}

代码示例来源:origin: FolioReader/FolioReader-Android

private void loadDictionary() {
  if (noNetwork.getVisibility() == View.VISIBLE || googleSearch.getVisibility() == View.VISIBLE) {
    noNetwork.setVisibility(View.GONE);
    googleSearch.setVisibility(View.GONE);
  }
  wikiWebView.loadUrl("about:blank");
  mAdapter.clear();
  dictionary.setSelected(true);
  wikipedia.setSelected(false);
  wikiLayout.setVisibility(View.GONE);
  dictResults.setVisibility(View.VISIBLE);
  DictionaryTask task = new DictionaryTask(this);
  String urlString = null;
  try {
    urlString = Constants.DICTIONARY_BASE_URL + URLEncoder.encode(word, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    Log.e(TAG, "-> loadDictionary", e);
  }
  task.execute(urlString);
}

代码示例来源:origin: FolioReader/FolioReader-Android

private void loadWikipedia() {
  if (noNetwork.getVisibility() == View.VISIBLE || googleSearch.getVisibility() == View.VISIBLE) {
    noNetwork.setVisibility(View.GONE);
    googleSearch.setVisibility(View.GONE);
  }
  wikiWebView.loadUrl("about:blank");
  mAdapter.clear();
  wikiLayout.setVisibility(View.VISIBLE);
  dictResults.setVisibility(View.GONE);
  dictionary.setSelected(false);
  wikipedia.setSelected(true);
  WikipediaTask task = new WikipediaTask(this);
  String urlString = null;
  try {
    urlString = Constants.WIKIPEDIA_API_URL + URLEncoder.encode(word, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    Log.e(TAG, "-> loadWikipedia", e);
  }
  task.execute(urlString);
}

代码示例来源: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);
}

相关文章

TextView类方法