本文整理了Java中android.widget.TextView.isSelected()
方法的一些代码示例,展示了TextView.isSelected()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.isSelected()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:isSelected
暂无
代码示例来源:origin: Rukey7/MvpApp
@OnClick({R.id.btn_select_all, R.id.btn_select_del, R.id.tv_close_edit})
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_select_all:
if (mCompleteFragment.isEditMode()) {
mCompleteFragment.checkAllOrNone(!mBtnSelectAll.isSelected());
}
if (mCacheFragment.isEditMode()) {
mCacheFragment.checkAllOrNone(!mBtnSelectAll.isSelected());
}
break;
case R.id.btn_select_del:
if (mCompleteFragment.isEditMode()) {
mCompleteFragment.deleteChecked();
}
if (mCacheFragment.isEditMode()) {
mCacheFragment.deleteChecked();
}
break;
case R.id.tv_close_edit:
if (mCompleteFragment.exitEditMode() || mCacheFragment.exitEditMode()) {
enableEditMode(false);
}
break;
}
}
代码示例来源: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: com.albedinsky.android.support/support-dialogs
/**
* Checks whether the primary title view selected or not.
*
* @return {@code True} if primary title view is selected, {@code false} if the secondary title
* view is selected.
*/
public boolean isPrimaryViewSelected() {
return mPrimaryView != null && mPrimaryView.isSelected();
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
* Checks whether the primary title view selected or not.
*
* @return {@code True} if primary title view is selected, {@code false} if the secondary title
* view is selected.
*/
public boolean isPrimaryViewSelected() {
return mPrimaryView != null && mPrimaryView.isSelected();
}
代码示例来源:origin: arvinljw/ClipView
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_start) {
mHandler.sendEmptyMessage(MSG_START);
return;
}
if (!pause.isSelected()) {
mHandler.sendEmptyMessage(MSG_PAUSE);
} else {
mHandler.sendEmptyMessage(MSG_CONTINUE);
}
}
代码示例来源:origin: stackoverflow.com
findViewById(R.id.txt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView textView = (TextView) v;
if (textView.isSelected()) {
textView.setTextColor(Color.RED);
v.setSelected(false);
} else {
textView.setTextColor(Color.BLUE);
v.setSelected(true);
}
}
});
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
*/
@Override
protected Parcelable onSaveInstanceState() {
final SavedState savedState = new SavedState(super.onSaveInstanceState());
savedState.primaryText = mPrimaryView != null ? mPrimaryView.getText() : "";
savedState.secondaryText = mSecondaryView != null ? mSecondaryView.getText() : "";
savedState.secondaryViewSelected = mSecondaryView != null && mSecondaryView.isSelected();
return savedState;
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
*/
@Override
protected Parcelable onSaveInstanceState() {
final SavedState savedState = new SavedState(super.onSaveInstanceState());
savedState.primaryText = mPrimaryView != null ? mPrimaryView.getText() : "";
savedState.secondaryText = mSecondaryView != null ? mSecondaryView.getText() : "";
savedState.secondaryViewSelected = mSecondaryView != null && mSecondaryView.isSelected();
return savedState;
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
*/
@Override
protected Parcelable onSaveInstanceState() {
final SavedState savedState = new SavedState(super.onSaveInstanceState());
savedState.mode = mMode;
savedState.hourText = mHourView != null ? mHourView.getText() : "";
savedState.minuteText = mMinuteView != null ? mMinuteView.getText() : "";
savedState.hourSelected = mHourView != null && mHourView.isSelected();
savedState.amSelected = mButtonAm != null && mButtonPm.isSelected();
return savedState;
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
*/
@Override
protected Parcelable onSaveInstanceState() {
final SavedState savedState = new SavedState(super.onSaveInstanceState());
savedState.mode = mMode;
savedState.hourText = mHourView != null ? mHourView.getText() : "";
savedState.minuteText = mMinuteView != null ? mMinuteView.getText() : "";
savedState.hourSelected = mHourView != null && mHourView.isSelected();
savedState.amSelected = mButtonAm != null && mButtonPm.isSelected();
return savedState;
}
代码示例来源:origin: guofudong/EShop
@OnClick({R.id.text_set_default, R.id.text_edit, R.id.text_delete})
void onClick(View view) {
switch (view.getId()) {
case R.id.text_set_default:
if (tvSetDefault.isSelected()) return;
onSetDefault(mAddress);
break;
case R.id.text_edit:
onEdit(mAddress);
break;
case R.id.text_delete:
onDelete(mAddress);
break;
default:
throw new UnsupportedOperationException();
}
}
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
* Updates a selection state of the hour view to <b>selected</b>. If the minute view is currently
* the selected one, this will cancel its selection.
*/
public void selectHourView() {
if (mMinuteView == null || mHourView == null || mHourView.isSelected()) {
return;
}
mHourView.setSelected(true);
mMinuteView.setSelected(false);
if (mListener != null) {
mListener.onHourMinuteSelectionChanged(this, true);
}
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
* Updates a selection state of the minute view to <b>selected</b>. If the hour view is currently
* the selected one, this will cancel its selection.
*/
public void selectMinuteView() {
if (mHourView == null || mMinuteView == null || mMinuteView.isSelected()) {
return;
}
mHourView.setSelected(false);
mMinuteView.setSelected(true);
if (mListener != null) {
mListener.onHourMinuteSelectionChanged(this, false);
}
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
* Updates a selection state of the minute view to <b>selected</b>. If the hour view is currently
* the selected one, this will cancel its selection.
*/
public void selectMinuteView() {
if (mHourView == null || mMinuteView == null || mMinuteView.isSelected()) {
return;
}
mHourView.setSelected(false);
mMinuteView.setSelected(true);
if (mListener != null) {
mListener.onHourMinuteSelectionChanged(this, false);
}
}
代码示例来源:origin: smartown/TableLayout
public void onClick(float y) {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
TextView textView = (TextView) getChildAt(i);
if (textView.getBottom() >= y) {
if (i == 0) {
return;
}
textView.setSelected(!textView.isSelected());
textView.setBackgroundColor(textView.isSelected() ? callback.getTableLayout().getBackgroundColorSelected() : Color.TRANSPARENT);
textView.setTextColor(textView.isSelected() ? callback.getTableLayout().getTableTextColorSelected() : callback.getTableLayout().getTableTextColor());
return;
}
}
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
* Updates a selection state of the hour view to <b>selected</b>. If the minute view is currently
* the selected one, this will cancel its selection.
*/
public void selectHourView() {
if (mMinuteView == null || mHourView == null || mHourView.isSelected()) {
return;
}
mHourView.setSelected(true);
mMinuteView.setSelected(false);
if (mListener != null) {
mListener.onHourMinuteSelectionChanged(this, true);
}
}
代码示例来源:origin: donkingliang/LabelsView
private void setLabelSelect(TextView label, boolean isSelect) {
if (label.isSelected() != isSelect) {
label.setSelected(isSelect);
if (isSelect) {
mSelectLabels.add((Integer) label.getTag(KEY_POSITION));
} else {
mSelectLabels.remove((Integer) label.getTag(KEY_POSITION));
}
if (mLabelSelectChangeListener != null) {
mLabelSelectChangeListener.onLabelSelectChange(label, label.getTag(KEY_DATA),
isSelect, (int) label.getTag(KEY_POSITION));
}
}
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
* Selects the secondary title view, if it is not selected yet.
* <p>
* Also {@link OnViewsSelectionListener} will be notified via {@link OnViewsSelectionListener#onSecondaryViewSelected()}
* callback.
*
* @see #selectPrimaryView()
*/
public void selectSecondaryView() {
if (mSecondaryView.isSelected()) {
return;
}
mPrimaryView.setSelected(false);
mSecondaryView.setSelected(true);
if (mListener != null) {
mListener.onSecondaryViewSelected();
}
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
* Selects the primary title view, if it is not selected yet.
* <p>
* Also {@link OnViewsSelectionListener} will be notified via {@link OnViewsSelectionListener#onPrimaryViewSelected()}
* callback.
*
* @see #selectSecondaryView()
*/
public void selectPrimaryView() {
if (mPrimaryView.isSelected()) {
return;
}
mSecondaryView.setSelected(false);
mPrimaryView.setSelected(true);
if (mListener != null) {
mListener.onPrimaryViewSelected();
}
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
* Selects the primary title view, if it is not selected yet.
* <p>
* Also {@link OnViewsSelectionListener} will be notified via {@link OnViewsSelectionListener#onPrimaryViewSelected()}
* callback.
*
* @see #selectSecondaryView()
*/
public void selectPrimaryView() {
if (mPrimaryView.isSelected()) {
return;
}
mSecondaryView.setSelected(false);
mPrimaryView.setSelected(true);
if (mListener != null) {
mListener.onPrimaryViewSelected();
}
}
内容来源于网络,如有侵权,请联系作者删除!