當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setClickable方法代碼示例

本文整理匯總了Java中android.widget.TextView.setClickable方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setClickable方法的具體用法?Java TextView.setClickable怎麽用?Java TextView.setClickable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setClickable方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findViews

import android.widget.TextView; //導入方法依賴的package包/類
private void findViews(View view) {
    tvShopcartEdit = (TextView) view.findViewById(R.id.tv_shopcart_edit);
    recyclerview = (RecyclerView) view.findViewById(R.id.recyclerview);
    llCheckAll = (LinearLayout) view.findViewById(R.id.ll_check_all);
    checkboxAll = (CheckBox) view.findViewById(R.id.checkbox_all);
    tvShopcartTotal = (TextView) view.findViewById(R.id.tv_shopcart_total);
    btnCheckOut = (Button) view.findViewById(R.id.btn_check_out);
    llDelete = (LinearLayout) view.findViewById(R.id.ll_delete);
    cbAll = (CheckBox) view.findViewById(R.id.cb_all);
    btnDelete = (Button) view.findViewById(R.id.btn_delete);
    btnCollection = (Button) view.findViewById(R.id.btn_collection);
    ivEmpty = (ImageView) view.findViewById(R.id.iv_empty);
    tvEmptyCartTobuy = (TextView) view.findViewById(R.id.tv_empty_cart_tobuy);
    ll_empty_shopcart = (LinearLayout) view.findViewById(R.id.ll_empty_shopcart);
    tvEmptyCartTobuy.setClickable(true);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:ShoppingCartFragment.java

示例2: findViews

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Find the Views in the layout<br />
 * <br />
 * Auto-created on 2016-10-11 21:08:02 by Android Layout Finder
 * (http://www.buzzingandroid.com/tools/android-layout-finder)
 */
private void findViews() {
    ibShopcartBack = (ImageButton) findViewById(R.id.ib_shopcart_back);
    tvShopcartEdit = (TextView) findViewById(R.id.tv_shopcart_edit);
    recyclerview = (RecyclerView) findViewById(R.id.recyclerview);
    checkboxAll = (CheckBox) findViewById(R.id.checkbox_all);
    tvShopcartTotal = (TextView) findViewById(R.id.tv_shopcart_total);
    btnCheckOut = (Button) findViewById(R.id.btn_check_out);
    ll_check_all = (LinearLayout) findViewById(R.id.ll_check_all);
    ll_delete = (LinearLayout) findViewById(R.id.ll_delete);
    cb_all = (CheckBox) findViewById(R.id.cb_all);
    btn_delete = (Button) findViewById(R.id.btn_delete);
    btn_collection = (Button) findViewById(R.id.btn_collection);
    ll_empty_shopcart = (LinearLayout) findViewById(R.id.ll_empty_shopcart);
    tv_empty_cart_tobuy = (TextView) findViewById(R.id.tv_empty_cart_tobuy);

    ibShopcartBack.setOnClickListener(this);
    btnCheckOut.setOnClickListener(this);
    tvShopcartEdit.setOnClickListener(this);
    btn_delete.setOnClickListener(this);
    tv_empty_cart_tobuy.setClickable(true);
    tv_empty_cart_tobuy.setOnClickListener(this);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:ShoppingCartActivity.java

示例3: addChildWithWord

import android.widget.TextView; //導入方法依賴的package包/類
private void addChildWithWord(String word) {
    TextView textView = new TextView(getContext());
    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    textView.setLayoutParams(lp);

    textView.setPadding(25, 15, 25, 15);
    textView.setTextSize(15);
    textView.setTextColor(Color.WHITE);
    textView.setText(word);
    textView.setBackgroundColor(getRandomColor());

    textView.setClickable(true);
    textView.setOnClickListener(this);

    addView(textView);
    requestLayout();
}
 
開發者ID:1014277960,項目名稱:DailyReader,代碼行數:18,代碼來源:FlowLayout.java

示例4: onBindView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onBindView(View view) {
    super.onBindView(view);
    TextView titleView = (TextView) view.findViewById(android.R.id.title);
    titleView.setSingleLine(false);

    if (mImitateWebLink) {
        setSelectable(false);

        titleView.setClickable(true);
        titleView.setTextColor(titleView.getPaint().linkColor);
        titleView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                HyperlinkPreference.this.onClick();
            }
        });
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:20,代碼來源:HyperlinkPreference.java

示例5: initData

import android.widget.TextView; //導入方法依賴的package包/類
private void initData(String[] mVals) {

        for (int i = 0; i < mVals.length; i++) {

            tv = (TextView) mInflater.inflate(
                    R.layout.search_label_tv, mFlowLayout, false);
            tv.setTextColor(getResources().getColor(R.color.cardview_dark_background));
            tv.setText(mVals[i]);
            tv.setClickable(true);
            tv.setFocusable(true);
            mFlowLayout.addView(tv);
            final String str = tv.getText().toString().trim();
            tv.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View view) {
                    String string = etSearch.getText().toString().trim();
                    etSearch.setText(string + " " + str);
                }
            });

        }
    }
 
開發者ID:paradoxie,項目名稱:DizzyPassword,代碼行數:24,代碼來源:SearchView.java

示例6: setView

import android.widget.TextView; //導入方法依賴的package包/類
private boolean setView(int id, String packageName) {
    TextView donate = (TextView) findViewById(id);
    PackageManager pm = getPackageManager();
    try {
        ApplicationInfo info = pm.getApplicationInfo(packageName, 0);
        if (!info.enabled) {
            return false;
        }
        CharSequence label = getLabel(pm, info);
        donate.setContentDescription(label);
        donate.setCompoundDrawablesWithIntrinsicBounds(null, cropDrawable(pm.getApplicationIcon(info)), null, null);
        donate.setText(label);
        donate.setClickable(true);
        donate.setOnClickListener(this);
        donate.setVisibility(View.VISIBLE);
        return true;
    } catch (PackageManager.NameNotFoundException e) {
        UILog.d("cannot find package " + packageName, e);
        return false;
    }
}
 
開發者ID:brevent,項目名稱:prevent,代碼行數:22,代碼來源:UserGuideActivity.java

示例7: getTextView

import android.widget.TextView; //導入方法依賴的package包/類
private TextView getTextView(String textToBeDisplayed, View.OnClickListener clickListener) {
    TextView textView = new TextView(FormatChoiceActivity.this);
    textView.setText(textToBeDisplayed);
    textView.setTextColor(getResources().getColor(R.color.colorBlack));
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.setMargins(0, 50, 0, 50);
    textView.setLayoutParams(lp);
    textView.setTextSize(18);
    textView.setClickable(true);
    textView.setGravity(Gravity.CENTER);
    textView.setOnClickListener(clickListener);
    return textView;
}
 
開發者ID:prebid,項目名稱:prebid-mobile-android,代碼行數:14,代碼來源:FormatChoiceActivity.java

示例8: initListView

import android.widget.TextView; //導入方法依賴的package包/類
protected void initListView(){
    Context context = contextWeak.get();
    if(context == null) return;

    ListView alertButtonListView = (ListView) contentContainer.findViewById(R.id.alertButtonListView);

    if(cancel != null && style == Style.Alert){
        View itemView = LayoutInflater.from(context).inflate(R.layout.item_actionsheetbutton, null);
        TextView tvAlert = (TextView) itemView.findViewById(R.id.tvAlert);
        tvAlert.setText(cancel);
        tvAlert.setClickable(true);
        tvAlert.setTypeface(Typeface.DEFAULT_BOLD);
        tvAlert.setTextColor(context.getResources().getColor(R.color.textColor_alert_button_cancel));
        tvAlert.setBackgroundResource(R.drawable.bg_alertbutton_bottom);
        tvAlert.setOnClickListener(new OnTextClickListener(CANCELPOSITION));
        alertButtonListView.addFooterView(itemView);
    }
    AlertViewAdapter adapter = new AlertViewAdapter(mDatas,mDestructive);
    alertButtonListView.setAdapter(adapter);
    alertButtonListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            if(onItemClickListener != null)onItemClickListener.onItemClick(AlertView.this,position);
            dismiss();
        }
    });
}
 
開發者ID:AppHero2,項目名稱:Raffler-Android,代碼行數:28,代碼來源:AlertView.java

示例9: init

import android.widget.TextView; //導入方法依賴的package包/類
private void init(Context context) {
	tvEmpty = new TextView(context);
	int tvEmptySize = getResources().getDimensionPixelSize(ResHelper.getResId(context, "dimen", "bbs_empty_view_txt_size"));
	tvEmpty.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvEmptySize);
	int padding = ResHelper.dipToPx(context, 10);
	tvEmpty.setPadding(padding, padding, padding, padding);
	int tvEmptyColor = getResources().getColor(ResHelper.getColorRes(context, "bbs_empty_view_txt_color"));
	tvEmpty.setTextColor(tvEmptyColor);
	tvEmpty.setId(ResHelper.getIdRes(context, "tvEmpty"));

	ivEmpty = new ImageView(context);
	ivEmpty.setScaleType(ImageView.ScaleType.CENTER);

	LayoutParams rlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
	rlp.addRule(CENTER_IN_PARENT, TRUE);
	addView(tvEmpty, rlp);

	rlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
	rlp.addRule(CENTER_HORIZONTAL, TRUE);
	rlp.addRule(ABOVE, tvEmpty.getId());
	addView(ivEmpty, rlp);

	OnClickListener ocl = new OnClickListener() {
		public void onClick(View view) {
			tvEmpty.setClickable(false);
			ivEmpty.setClickable(false);
			if (onRefreshClickListener != null) {
				onRefreshClickListener.onClick(view);
			}
		}
	};
	tvEmpty.setClickable(false);
	ivEmpty.setClickable(false);
	tvEmpty.setOnClickListener(ocl);
	ivEmpty.setOnClickListener(ocl);
}
 
開發者ID:MobClub,項目名稱:BBSSDK-for-Android,代碼行數:37,代碼來源:EmptyView.java

示例10: selectPayType

import android.widget.TextView; //導入方法依賴的package包/類
private void selectPayType(View view) {
    mTvWeixin.setBackgroundResource(R.color.bg_color);
    mTvAlipay.setBackgroundResource(R.color.bg_color);
    mTvWeixin.setTextColor(getResources().getColor(R.color.black));
    mTvAlipay.setTextColor(getResources().getColor(R.color.black));
    mTvWeixin.setClickable(true);
    mTvAlipay.setClickable(true);
    TextView tv = (TextView) view;
    tv.setBackgroundResource(R.color.red);
    tv.setClickable(false);
    tv.setTextColor(getResources().getColor(R.color.white));
    currentpaytype = Integer.valueOf((String) tv.getTag());
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:14,代碼來源:DepositRefundIssueActivity.java

示例11: initListView

import android.widget.TextView; //導入方法依賴的package包/類
protected void initListView(){
    Context context = contextWeak.get();
    if(context == null) return;

    ListView alertButtonListView = (ListView) contentContainer.findViewById(R.id.alertButtonListView);
    //把cancel作為footerView
    if(cancel != null && style == Style.Alert){
        View itemView = LayoutInflater.from(context).inflate(R.layout.item_alertbutton, null);
        TextView tvAlert = (TextView) itemView.findViewById(R.id.tvAlert);
        tvAlert.setText(cancel);
        tvAlert.setClickable(true);
        tvAlert.setTypeface(Typeface.DEFAULT_BOLD);
        tvAlert.setTextColor(context.getResources().getColor(R.color.textColor_alert_button_cancel));
        tvAlert.setBackgroundResource(R.drawable.bg_alertbutton_bottom);
        tvAlert.setOnClickListener(new OnTextClickListener(CANCELPOSITION));
        alertButtonListView.addFooterView(itemView);
    }
    AlertViewAdapter adapter = new AlertViewAdapter(mDatas,mDestructive);
    alertButtonListView.setAdapter(adapter);
    alertButtonListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            if(onItemClickListener != null)onItemClickListener.onItemClick(AlertView.this,position);
            dismiss();
        }
    });
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:28,代碼來源:AlertView.java

示例12: onFinishInflate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onFinishInflate() {
    final int childCount = getChildCount();
    if (childCount > 2) {
        throw new IllegalStateException("PtrFrameLayout can only contains 2 children");
    } else if (childCount == 2) {
        if (mHeaderId != 0 && mHeaderView == null) {
            mHeaderView = findViewById(mHeaderId);
        }
        if (mContainerId != 0 && mContent == null) {
            mContent = findViewById(mContainerId);
        }

        // not specify header or content
        if (mContent == null || mHeaderView == null) {

            View child1 = getChildAt(0);
            View child2 = getChildAt(1);
            if (child1 instanceof PtrUIHandler) {
                mHeaderView = child1;
                mContent = child2;
            } else if (child2 instanceof PtrUIHandler) {
                mHeaderView = child2;
                mContent = child1;
            } else {
                // both are not specified
                if (mContent == null && mHeaderView == null) {
                    mHeaderView = child1;
                    mContent = child2;
                }
                // only one is specified
                else {
                    if (mHeaderView == null) {
                        mHeaderView = mContent == child1 ? child2 : child1;
                    } else {
                        mContent = mHeaderView == child1 ? child2 : child1;
                    }
                }
            }
        }
    } else if (childCount == 1) {
        mContent = getChildAt(0);
    } else {
        TextView errorView = new TextView(getContext());
        errorView.setClickable(true);
        errorView.setTextColor(0xffff6600);
        errorView.setGravity(Gravity.CENTER);
        errorView.setTextSize(20);
        errorView.setText("The content view in PtrFrameLayout is empty. Do you forget to specify its id in xml layout file?");
        mContent = errorView;
        addView(mContent);
    }
    if (mHeaderView != null) {
        mHeaderView.bringToFront();
    }
    super.onFinishInflate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:58,代碼來源:PtrFrameLayout.java

示例13: addNought

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void addNought(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("O");
  textView.setClickable(false);
}
 
開發者ID:uber,項目名稱:RIBs,代碼行數:7,代碼來源:TicTacToeView.java

示例14: addCross

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void addCross(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("x");
  textView.setClickable(false);
}
 
開發者ID:uber,項目名稱:RIBs,代碼行數:7,代碼來源:TicTacToeView.java


注:本文中的android.widget.TextView.setClickable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。