本文整理汇总了Java中android.widget.TextView.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setEnabled方法的具体用法?Java TextView.setEnabled怎么用?Java TextView.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTeamInfo
import android.widget.TextView; //导入方法依赖的package包/类
private void updateTeamInfo(Team t) {
if (t == null) {
return;
}
team = t;
// title
String teamName = team.getName();
setTitle(teamName);
// team name
View nameView = findViewById(R.id.settings_item_name);
teamNameTextView = (TextView) nameView.findViewById(R.id.item_detail);
teamNameTextView.setText(teamName);
teamNameTextView.setEnabled(isSelfAdmin);
setToggleBtn(team);
}
示例2: initWidgets
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void initWidgets() {
super.initWidgets();
mImgContainerLayout = (LinearLayout) findViewById(R.id.kf5_feed_back_image_layout);
mETContent = (EditText) findViewById(R.id.kf5_feed_back_content_et);
mETContent.setOnTouchListener(this);
mETContent.addTextChangedListener(new ETTextWatcher());
mImgChoiceImg = (ImageView) findViewById(R.id.kf5_feed_back_choice_img);
mImgChoiceImg.setOnClickListener(this);
mParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
mParams.bottomMargin = 1;
mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
mBackImg.setOnClickListener(this);
mTVSubmit = (TextView) findViewById(R.id.kf5_right_text_view);
mTVSubmit.setOnClickListener(this);
mTVSubmit.setEnabled(false);
}
示例3: getView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = View.inflate(mActivity, R.layout.list_item_left_menu,null);
TextView tvMenu = (TextView) view.findViewById(R.id.tv_menu);
NewsMenuData item = getItem(position);
tvMenu.setText(item.title);
//����ѡ�в˵���ɫ
if(position==mCurrentPos){
//��ѡ��
tvMenu.setEnabled(true);
}else{
tvMenu.setEnabled(false);
}
return view;
}
示例4: initViews
import android.widget.TextView; //导入方法依赖的package包/类
private void initViews() {
//提醒设置
ivStart = (ImageView)findViewById(R.id.from);
ivStart.setOnClickListener(this);
ivEnd = (ImageView)findViewById(R.id.to);
ivEnd.setOnClickListener(this);
btnPreReminderTime = (Button)findViewById(R.id.time);
btnPreReminderTime.setOnClickListener(this);
ivRing = (ImageView)findViewById(R.id.ring);
ivRing.setOnClickListener(this);
ivVibrate = (ImageView)findViewById(R.id.vibrate);
ivVibrate.setOnClickListener(this);
tvMIUIRepair = (TextView)findViewById(R.id.repair);
tvMIUIRepair.setOnClickListener(this);
Button btnReminderDemo = (Button)findViewById(R.id.demo);
btnReminderDemo.setOnClickListener(this);
btnPreReminderTime.setText(setSP.getPreReminderTimeString());
ivVibrate.setImageResource(setSP.isVibrate()==true ? R.drawable.chat_on:R.drawable.chat_off);
ivRing.setImageResource(setSP.isRing()==true ? R.drawable.chat_on:R.drawable.chat_off);
ivStart.setImageResource(setSP.isStartReminder()==true ? R.drawable.chat_on:R.drawable.chat_off);
ivEnd.setImageResource(setSP.isEndReminder()==true ? R.drawable.chat_on:R.drawable.chat_off);
if (!setSP.isReminderSet()){
btnPreReminderTime.setEnabled(false);
ivRing.setEnabled(false);
ivVibrate.setEnabled(false);
tvMIUIRepair.setEnabled(false);
}else{
btnPreReminderTime.setEnabled(true);
ivRing.setEnabled(true);
ivVibrate.setEnabled(true);
tvMIUIRepair.setEnabled(true);
}
}
示例5: bindViews
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void bindViews(View view) {
cbx_select = (CheckBox) view.findViewById(R.id.cbx_select);
tv_name = (TextView) view.findViewById(R.id.tv_name);
mCarrier = (TextView) view.findViewById(R.id.tv_carrier);
mSkuType = (TextView) view.findViewById(R.id.tv_skuType);
mSkuBrand = (TextView) view.findViewById(R.id.tv_skuBrand);
mPurNum = (TextView) view.findViewById(R.id.tv_num);
addView = (ImageView) view.findViewById(R.id.addView);
subView = (ImageView) view.findViewById(R.id.subView);
addView.setVisibility(tmpSelectModel.multi ? View.VISIBLE : View.GONE);
subView.setVisibility(tmpSelectModel.multi ? View.VISIBLE : View.GONE);
mPurNum.setEnabled(false);
mUnit = (TextView) view.findViewById(R.id.tv_unit);
mUnitPrice = (TextView) view.findViewById(R.id.tv_unitPrice);
mArrivalTime = (TextView) view.findViewById(R.id.tv_arrivalTime);
mPurRemark = (TextView) view.findViewById(R.id.tv_purRemark);
}
示例6: getView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = LayoutInflater.from(context).inflate(R.layout.item_column_item, null);
item_text = (TextView) view.findViewById(R.id.text_item);
String className = getItem(position).getClassname();
item_text.setText(className);
if (isSelected) {
if (position == 0) {
item_text.setEnabled(false);
}
}
if (!isVisible && (position == -1 + optionalList.size())) {
item_text.setText("");
item_text.setSelected(true);
item_text.setEnabled(true);
}
if (remove_position == position) {
item_text.setText("");
}
return view;
}
示例7: onCreateView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//final Context context = inflater.getContext();
final View view = inflater.inflate(R.layout.fragment_move, container, false);
view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));
mCancel = (ImageButton) view.findViewById(android.R.id.button2);
mCancel.setOnClickListener(this);
mMoveInfo = (TextView) view.findViewById(android.R.id.title);
mMoveInfo.setText("Paste " + FileUtils.formatFileCount(docs.size()) + " in ");
mMoveInfo.setEnabled(false);
mRootInfo = (TextView) view.findViewById(android.R.id.text1);
mSave = (ImageButton) view.findViewById(android.R.id.button1);
mSave.setOnClickListener(this);
mSave.setEnabled(false);
mProgress = (MaterialProgressBar) view.findViewById(android.R.id.progress);
mProgress.setColor(SettingsActivity.getAccentColor());
return view;
}
示例8: setCheckInUI
import android.widget.TextView; //导入方法依赖的package包/类
private void setCheckInUI(int count, boolean isChecked) {
boolean z;
String message = String.format(getString(R.string.d7), new Object[]{Integer.valueOf
(count)});
SpannableString ss = new SpannableString(message);
ss.setSpan(new ForegroundColorSpan(SupportMenu.CATEGORY_MASK), 5, message.length() - 1, 33);
this.checkInMsgText.setText(ss);
this.checkInBtn.setText(isChecked ? R.string.d4 : R.string.d6);
TextView textView = this.checkInBtn;
if (isChecked) {
z = false;
} else {
z = true;
}
textView.setEnabled(z);
}
示例9: updateRightTopBtn
import android.widget.TextView; //导入方法依赖的package包/类
private void updateRightTopBtn(Context context, TextView rightTopBtn, boolean isEnable) {
rightTopBtn.setText(R.string.done);
rightTopBtn.setBackgroundResource(R.drawable.g_white_btn_selector);
rightTopBtn.setEnabled(isEnable);
rightTopBtn.setTextColor(context.getResources().getColor(R.color.color_blue_0888ff));
rightTopBtn.setPadding(ScreenUtil.dip2px(10), 0, ScreenUtil.dip2px(10), 0);
}
示例10: layoutWord
import android.widget.TextView; //导入方法依赖的package包/类
/**
* Format appropriately the suggested word in {@link #mWordViews} specified by
* <code>positionInStrip</code>. When the suggested word doesn't exist, the corresponding
* {@link TextView} will be disabled and never respond to user interaction. The suggested word
* may be shrunk or ellipsized to fit in the specified width.
*
* The <code>positionInStrip</code> argument is the index in the suggestion strip. The indices
* increase towards the right for LTR scripts and the left for RTL scripts, starting with 0.
* The position of the most important suggestion is in {@link #mCenterPositionInStrip}. This
* usually doesn't match the index in <code>suggedtedWords</code> -- see
* {@link #getPositionInSuggestionStrip(int,SuggestedWords)}.
*
* @param positionInStrip the position in the suggestion strip.
* @param width the maximum width for layout in pixels.
* @return the {@link TextView} containing the suggested word appropriately formatted.
*/
private TextView layoutWord(final Context context, final int positionInStrip, final int width) {
final TextView wordView = mWordViews.get(positionInStrip);
final CharSequence word = wordView.getText();
if (positionInStrip == mCenterPositionInStrip && mMoreSuggestionsAvailable) {
// TODO: This "more suggestions hint" should have a nicely designed icon.
wordView.setCompoundDrawablesWithIntrinsicBounds(
null, null, null, mMoreSuggestionsHint);
// HACK: Align with other TextViews that have no compound drawables.
wordView.setCompoundDrawablePadding(-mMoreSuggestionsHint.getIntrinsicHeight());
} else {
wordView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
// {@link StyleSpan} in a content description may cause an issue of TTS/TalkBack.
// Use a simple {@link String} to avoid the issue.
wordView.setContentDescription(
TextUtils.isEmpty(word)
? context.getResources().getString(R.string.spoken_empty_suggestion)
: word.toString());
final CharSequence text = getEllipsizedTextWithSettingScaleX(
word, width, wordView.getPaint());
final float scaleX = wordView.getTextScaleX();
wordView.setText(text); // TextView.setText() resets text scale x to 1.0.
wordView.setTextScaleX(scaleX);
// A <code>wordView</code> should be disabled when <code>word</code> is empty in order to
// make it unclickable.
// With accessibility touch exploration on, <code>wordView</code> should be enabled even
// when it is empty to avoid announcing as "disabled".
wordView.setEnabled(!TextUtils.isEmpty(word)
|| AccessibilityUtils.getInstance().isTouchExplorationEnabled());
return wordView;
}
示例11: getView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = LayoutInflater.from(context).inflate(R.layout.item_column_item, null);
item_text = (TextView) view.findViewById(R.id.text_item);
String className = getItem(position).getClassname();
item_text.setText(className);
if (isUser) {
if (position == 0) {
item_text.setEnabled(false);
}
}
if (isChanged && (position == holdPosition) && !isItemShow) {
item_text.setText("");
item_text.setSelected(true);
item_text.setEnabled(true);
isChanged = false;
}
if (!isVisible && (position == -1 + selectedList.size())) {
item_text.setText("");
item_text.setSelected(true);
item_text.setEnabled(true);
}
if (remove_position == position) {
item_text.setText("");
}
return view;
}
示例12: setupCopyright
import android.widget.TextView; //导入方法依赖的package包/类
private TextView setupCopyright() {
// Display copyright text in bottom right corner
TextView copyrightText = new TextView(getContext());
copyrightText.setEnabled(false);
copyrightText.setText(R.string.map_copyright_mml);
copyrightText.setPadding(0, 0, 5, 0);
copyrightText.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, copyrightText.getId());
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, copyrightText.getId());
copyrightText.setLayoutParams(params);
return copyrightText;
}
示例13: setButtonEnabled
import android.widget.TextView; //导入方法依赖的package包/类
private void setButtonEnabled(boolean enabled, TextView view) {
view.setEnabled(enabled);
if (enabled) {
view.setTextColor(getResources().getColor(R.color.white));
} else {
view.setTextColor(getResources().getColor(R.color.colorWhiteAlpha30));
}
}
示例14: setupCounter
import android.widget.TextView; //导入方法依赖的package包/类
protected static void setupCounter(TextView view, int count) {
view.setText((count > 0 ? (AppTextUtils.getCounterWithK(count)) : "-"));
view.setEnabled(count > 0);
}
示例15: setEnabled
import android.widget.TextView; //导入方法依赖的package包/类
/**
* 不可编辑
*
* @param textViews
*/
public static void setEnabled(boolean enabled, TextView... textViews) {
for (TextView e : textViews) {
e.setEnabled(enabled);
}
}