Java Code Examples for android.widget.TextView.setClickable()

The following are Jave code examples for showing how to use setClickable() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: GitHub   File: ShoppingCartFragment.java   Source Code and License Vote up 6 votes
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);
}
 
Example 2
Project: GitHub   File: ShoppingCartActivity.java   Source Code and License Vote up 6 votes
/**
 * 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);
}
 
Example 3
Project: DailyReader   File: FlowLayout.java   Source Code and License Vote up 6 votes
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();
}
 
Example 4
Project: chromium-for-android-56-debug-video   File: HyperlinkPreference.java   Source Code and License Vote up 6 votes
@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();
            }
        });
    }
}
 
Example 5
Project: DizzyPassword   File: SearchView.java   Source Code and License Vote up 6 votes
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);
                }
            });

        }
    }
 
Example 6
Project: prevent   File: UserGuideActivity.java   Source Code and License Vote up 6 votes
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;
    }
}
 
Example 7
Project: prebid-mobile-android   File: FormatChoiceActivity.java   Source Code and License Vote up 5 votes
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;
}
 
Example 8
Project: Raffler-Android   File: AlertView.java   Source Code and License Vote up 5 votes
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();
        }
    });
}
 
Example 9
Project: BBSSDK-for-Android   File: EmptyView.java   Source Code and License Vote up 5 votes
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);
}
 
Example 10
Project: Mobike   File: DepositRefundIssueActivity.java   Source Code and License Vote up 5 votes
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());
}
 
Example 11
Project: NeiHanDuanZiTV   File: AlertView.java   Source Code and License Vote up 5 votes
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();
        }
    });
}
 
Example 12
Project: GitHub   File: PtrFrameLayout.java   Source Code and License Vote up 4 votes
@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();
}
 
Example 13
Project: RIBs   File: TicTacToeView.java   Source Code and License Vote up 4 votes
@Override
public void addNought(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("O");
  textView.setClickable(false);
}
 
Example 14
Project: Swface   File: PtrFrameLayout.java   Source Code and License Vote up 4 votes
@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();
}
 
Example 15
Project: RIBs   File: TicTacToeView.java   Source Code and License Vote up 4 votes
@Override
public void addNought(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("O");
  textView.setClickable(false);
}
 
Example 16
Project: RIBs   File: TicTacToeView.java   Source Code and License Vote up 4 votes
@Override
public void addCross(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("x");
  textView.setClickable(false);
}
 
Example 17
Project: RIBs   File: TicTacToeView.java   Source Code and License Vote up 4 votes
@Override
public void addCross(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("x");
  textView.setClickable(false);
}
 
Example 18
Project: RIBs   File: TicTacToeView.java   Source Code and License Vote up 4 votes
@Override
public void addCross(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("x");
  textView.setClickable(false);
}
 
Example 19
Project: android-Ultra-Pull-To-Refresh   File: PtrFrameLayout.java   Source Code and License Vote up 4 votes
@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();
}
 
Example 20
Project: RIBs   File: TicTacToeView.java   Source Code and License Vote up 4 votes
@Override
public void addCross(BoardCoordinate xy) {
  TextView textView = imageButtons[xy.getX()][xy.getY()];
  textView.setText("x");
  textView.setClickable(false);
}