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


Java Button.setClickable方法代碼示例

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


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

示例1: Init

import android.widget.Button; //導入方法依賴的package包/類
public void Init() {
GetSurplusMemory();
Round_img=(ImageView)findViewById(R.id.eliminate_roundimg);
Start_kill=(Button)findViewById(R.id.start_killtask);
release_memory=(TextView)findViewById(R.id.relase_memory);
increase_speed=(TextView)findViewById(R.id.increase_speed);
Allpercent=(TextView)findViewById(R.id.all_percent);
clear_endlayout=(LinearLayout)findViewById(R.id.clear_endlayout);
Clearing_layout=(RelativeLayout)findViewById(R.id.clearing_layout);
Animation animation=AnimationUtils.loadAnimation(EliminateMainActivity.this, R.anim.eliminatedialog_anmiation);
TotalMemory=GetTotalMemory();
Round_img.setAnimation(animation);
Start_kill.setClickable(false);
Start_kill.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
	finish();	
	}
});
}
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:23,代碼來源:EliminateMainActivity.java

示例2: cancel

import android.widget.Button; //導入方法依賴的package包/類
public void cancel(View view) {

                if (null != mCurrentLocation) {

                        String lat = String.valueOf(mCurrentLocation.getLatitude());
                        String lng = String.valueOf(mCurrentLocation.getLongitude());
                        if (checkBusSelection != 0) {
                                //String BUS = "b" + checkBusSelection;
                                DatabaseReference userDatabase = mDatabase.child(VEHICLE).child(BUS);
                                //String key = userDatabase.push().getKey();

                                userDatabase.child(key).removeValue();
                                Toast.makeText(MapsActivity.this, "REQUEST ENDED", Toast.LENGTH_LONG).show();
                                Button button = (Button) findViewById(R.id.pick_me);
                                button.setClickable(true);
                                button.setBackgroundColor(Color.BLUE);

                        }

                } else {
                        Log.d(TAG, "location is null ...............");
                }

        }
 
開發者ID:kuldeep725,項目名稱:gogo,代碼行數:25,代碼來源:MapsActivity.java

示例3: generateSpanActionButton

import android.widget.Button; //導入方法依賴的package包/類
/**
 * 生成適用於對話框的按鈕
 */
public static Button generateSpanActionButton(Context context, String text, int iconRes, boolean hasLeftMargin) {
	Button button = new Button(context);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			ViewGroup.LayoutParams.WRAP_CONTENT,
			QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_height));
	if(hasLeftMargin){
		lp.leftMargin = QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_margin_left);
	}
	button.setLayoutParams(lp);
	button.setMinHeight(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_height));
	button.setMinWidth(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_min_width));
	button.setMinimumWidth(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_min_width));
	button.setMinimumHeight(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_height));
	button.setText(text);
	if (iconRes != 0) {
		Drawable drawable = context.getResources().getDrawable(iconRes);
		if (drawable != null) {
			drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
			button.setCompoundDrawables(drawable, null, null, null);
			button.setCompoundDrawablePadding(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_drawable_padding));
		}

	}
	button.setGravity(Gravity.CENTER);
	button.setClickable(true);
	button.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_text_size));
	button.setTextColor(QMUIResHelper.getAttrColorStateList(context, R.attr.qmui_dialog_action_text_color));
	button.setBackground(QMUIResHelper.getAttrDrawable(context, R.attr.qmui_dialog_action_btn_bg));
	final int paddingHor = QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_padding_horizontal);
	button.setPadding(paddingHor, 0, paddingHor, 0);
	return button;
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:36,代碼來源:QMUIDialogAction.java

示例4: setButtonStatus

import android.widget.Button; //導入方法依賴的package包/類
private void setButtonStatus(Button button, boolean canClick) {
    Logger.d(TAG, " setButtonStatus canClick : " + canClick);
    if (canClick) {
        button.setClickable(true);
        button.setBackgroundResource(R.drawable.btn_blue_selecter);
        button.setTextAppearance(this.mContext, R.style.letv_text_13_blue_white);
        return;
    }
    button.setClickable(false);
    button.setBackgroundResource(R.drawable.btn_grey);
    button.setTextColor(Util.getContext().getResources().getColor(R.color.letv_color_ffa1a1a1));
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:MyDownloadingFragment.java

示例5: setButtonStatus

import android.widget.Button; //導入方法依賴的package包/類
private void setButtonStatus(Button button, boolean canClick) {
    LogInfo.log(TAG, " setButtonStatus canClick : " + canClick);
    if (canClick) {
        button.setClickable(true);
        button.setBackgroundResource(2130837706);
        button.setTextAppearance(this.mActivity, 2131230855);
        return;
    }
    button.setClickable(false);
    button.setBackgroundResource(2130837728);
    button.setTextColor(getResources().getColor(2131493280));
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:MyRandomSeeFragment.java

示例6: addAButton

import android.widget.Button; //導入方法依賴的package包/類
private void addAButton(final String text) {
    int dimension = (int) PixelDipConverter.convertDpToPixel(50, getContext());
    //int padding = (int) PixelDipConverter.convertDpToPixel(10, getContext());
    final Button name = new Button(getContext());

    name.setLayoutParams(new LinearLayout.LayoutParams(dimension, dimension));


    name.setGravity(Gravity.CENTER);

    name.setText(text);
    name.setTextSize(15);
    name.setAllCaps(true);

    //name.setPadding(padding, padding, padding, padding);

    name.setClickable(true);

    name.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            iAccessoryView.onButtonAccessoryViewClicked(text);
        }
    });

    name.setBackgroundResource(outValue.resourceId);
    addView(name);
}
 
開發者ID:ujjwalagrawal17,項目名稱:CodeCompilerApp,代碼行數:29,代碼來源:AccessoryView.java

示例7: setButton

import android.widget.Button; //導入方法依賴的package包/類
private void setButton(boolean enable) {
    final SwitchButton vpnButton = (SwitchButton) findViewById(R.id.button_start_vpn);
    final Button selectHosts = (Button) findViewById(R.id.button_select_hosts);
    if (enable) {
        vpnButton.setChecked(false);
        selectHosts.setAlpha(1.0f);
        selectHosts.setClickable(true);
    } else {
        vpnButton.setChecked(true);
        selectHosts.setAlpha(.5f);
        selectHosts.setClickable(false);
    }
}
 
開發者ID:x-falcon,項目名稱:Virtual-Hosts,代碼行數:14,代碼來源:MainActivity.java

示例8: getView

import android.widget.Button; //導入方法依賴的package包/類
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(this.ctx).inflate(R.layout.no, null);
    }
    Button decreseBtn = (Button) convertView.findViewById(R.id.decrease_btn);
    Button increaseBtn = (Button) convertView.findViewById(R.id.increase_btn);
    TextView quantity = (TextView) convertView.findViewById(R.id.quantity_value);
    TextView Title = (TextView) convertView.findViewById(R.id.title);
    TextView price = (TextView) convertView.findViewById(R.id.price_value);
    RelativeLayout intoGoodsDetails = (RelativeLayout) convertView.findViewById(R.id
            .into_goods_detail);
    CartGoods goods = (CartGoods) this.goodsList.get(position);
    quantity.setText(String.valueOf(goods.quantity));
    float priceVaule = goods.base_price;
    price.setText(this.ctx.getString(R.string.ae4) + TextUtil.m2(priceVaule));
    this.loader.displayImage(goods.thumb_photo_url, (ImageView) convertView.findViewById(R.id
            .default_photo), this.options);
    AddBtnClickListener buttonListener = new AddBtnClickListener(quantity, decreseBtn,
            position, priceVaule, goods.goods_id);
    intoGoodsDetails.setOnClickListener(buttonListener);
    decreseBtn.setVisibility(4);
    increaseBtn.setVisibility(4);
    decreseBtn.setOnClickListener(buttonListener);
    if (Integer.parseInt(String.valueOf(quantity.getText())) == 1) {
        decreseBtn.setClickable(false);
        decreseBtn.setEnabled(false);
    }
    increaseBtn.setOnClickListener(buttonListener);
    if (TextUtils.equals(goods_type.SpecGoods.name(), goods.type)) {
        Title.setText(goods.title);
    } else {
        Title.setText(goods.title + ShopUtils.getFormatInfo(goods.chosen_specs));
    }
    return convertView;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:36,代碼來源:OrderEditListAdapter.java

示例9: initView

import android.widget.Button; //導入方法依賴的package包/類
private void initView() {
    mPhoneEdit = (ClearWriteEditText) findViewById(R.id.reg_phone);
    mCodeEdit = (ClearWriteEditText) findViewById(R.id.reg_code);
    mNickEdit = (ClearWriteEditText) findViewById(R.id.reg_username);
    mPasswordEdit = (ClearWriteEditText) findViewById(R.id.reg_password);
    mGetCode = (Button) findViewById(R.id.reg_getcode);
    mConfirm = (Button) findViewById(R.id.reg_button);

    mGetCode.setOnClickListener(this);
    mGetCode.setClickable(false);
    mConfirm.setOnClickListener(this);

    TextView goLogin = (TextView) findViewById(R.id.reg_login);
    TextView goForget = (TextView) findViewById(R.id.reg_forget);
    goLogin.setOnClickListener(this);
    goForget.setOnClickListener(this);

    mImgBackground = (ImageView) findViewById(R.id.rg_img_backgroud);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Animation animation = AnimationUtils.loadAnimation(RegisterActivity.this, R.anim.translate_anim);
            mImgBackground.startAnimation(animation);
        }
    }, 200);

    addEditTextListener();

}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:30,代碼來源:RegisterActivity.java

示例10: pickMe

import android.widget.Button; //導入方法依賴的package包/類
public void pickMe(View view) {

        /*Bundle extras = getIntent().getExtras();
        String userId = extras.getString("email");
        assert userId != null;
        String[] temp = userId.split("@");
        userId = temp[0];*/

                if (null != mCurrentLocation) {
                        String lat = String.valueOf(mCurrentLocation.getLatitude());
                        String lng = String.valueOf(mCurrentLocation.getLongitude());
                        if (checkBusSelection != 0) {
                                BUS = "b" + checkBusSelection;
                                DatabaseReference userDatabase = mDatabase.child(VEHICLE).child(BUS);
                                Map<String, String> userData = new HashMap<>();
                                userData.put(LATITUDE, lat);
                                userData.put(LONGITUDE, lng);
                                key = userDatabase.push().getKey();
                                Map<String, Map<String, String>> mSendingData = new HashMap<>();
                                mSendingData.put("LOCATION", userData);
                                /*Map<String, Map<String, Map<String, String>>> mFinalData = new HashMap<>();
                                mFinalData.put(INTERMEDIATE, mSendingData);*/
                                userDatabase.child(key).setValue(mSendingData);

                                Toast.makeText(MapsActivity.this, "REQUEST SENT", Toast.LENGTH_LONG).show();
                                Button button = (Button) findViewById(R.id.pick_me);
                                button.setClickable(false);
                                button.setBackgroundColor(Color.GREEN);

                        }

                } else {
                        Log.d(TAG, "location is null ...............");
                }

        }
 
開發者ID:kuldeep725,項目名稱:gogo,代碼行數:37,代碼來源:MapsActivity.java

示例11: generateSpanActionButton

import android.widget.Button; //導入方法依賴的package包/類
/**
 * 生成適用於對話框的按鈕
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static Button generateSpanActionButton(Context context, String text, int iconRes, boolean hasLeftMargin) {
	Button button = new Button(context);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			ViewGroup.LayoutParams.WRAP_CONTENT,
			QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_height));
	if(hasLeftMargin){
		lp.leftMargin = QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_margin_left);
	}
	button.setLayoutParams(lp);
	button.setMinHeight(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_height));
	button.setMinWidth(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_min_width));
	button.setMinimumWidth(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_min_width));
	button.setMinimumHeight(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_height));
	button.setText(text);
	if (iconRes != 0) {
		Drawable drawable = ContextCompat.getDrawable(context, iconRes);
		if (drawable != null) {
			drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
			button.setCompoundDrawables(drawable, null, null, null);
			button.setCompoundDrawablePadding(QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_drawable_padding));
		}

	}
	button.setGravity(Gravity.CENTER);
	button.setClickable(true);
	button.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_text_size));
	button.setTextColor(QMUIResHelper.getAttrColorStateList(context, R.attr.qmui_dialog_action_text_color));
	button.setBackground(QMUIResHelper.getAttrDrawable(context, R.attr.qmui_dialog_action_btn_bg));
	final int paddingHor = QMUIResHelper.getAttrDimen(context, R.attr.qmui_dialog_action_button_padding_horizontal);
	button.setPadding(paddingHor, 0, paddingHor, 0);
	return button;
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:37,代碼來源:QMUIDialogAction.java

示例12: init

import android.widget.Button; //導入方法依賴的package包/類
private void init(String text, int iconRes) {
	LinearLayout.LayoutParams parentLp = new LinearLayout.LayoutParams(
			ViewGroup.LayoutParams.MATCH_PARENT,
			QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_action_block_btn_height));
	setLayoutParams(parentLp);
	setBackground(QMUIResHelper.getAttrDrawable(getContext(), R.attr.qmui_dialog_action_block_btn_bg));
	setPadding(
			QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_padding_horizontal),
			0,
			QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_padding_horizontal),
			0
	);

          mButton = new Button(getContext());
	mButton.setBackgroundResource(0);
	mButton.setPadding(0, 0, 0, 0);
	LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
	lp.gravity = Gravity.RIGHT;
	mButton.setLayoutParams(lp);
	mButton.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
	mButton.setText(text);
	if (iconRes != 0) {
		Drawable drawable = ContextCompat.getDrawable(getContext(), iconRes);
		if (drawable != null) {
			drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
			mButton.setCompoundDrawables(drawable, null, null, null);
			mButton.setCompoundDrawablePadding(QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_action_drawable_padding));
		}

	}
	mButton.setMinHeight(0);
	mButton.setMinWidth(0);
	mButton.setMinimumWidth(0);
	mButton.setMinimumHeight(0);
	mButton.setClickable(false);
	mButton.setDuplicateParentStateEnabled(true);
	mButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_action_button_text_size));
	mButton.setTextColor(QMUIResHelper.getAttrColorStateList(getContext(), R.attr.qmui_dialog_action_text_color));

	addView(mButton);
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:42,代碼來源:QMUIDialogAction.java

示例13: init

import android.widget.Button; //導入方法依賴的package包/類
private void init(String text, int iconRes) {
	LinearLayout.LayoutParams parentLp = new LinearLayout.LayoutParams(
			ViewGroup.LayoutParams.MATCH_PARENT,
			QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_action_block_btn_height));
	setLayoutParams(parentLp);
          QMUIViewHelper.setBackgroundKeepingPadding(this, QMUIResHelper.getAttrDrawable(getContext(), R.attr.qmui_dialog_action_block_btn_bg));
	setPadding(
			QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_padding_horizontal),
			0,
			QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_padding_horizontal),
			0
	);

          mButton = new Button(getContext());
	mButton.setBackgroundResource(0);
	mButton.setPadding(0, 0, 0, 0);
	LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
	lp.gravity = Gravity.RIGHT;
	mButton.setLayoutParams(lp);
	mButton.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
	mButton.setText(text);
	if (iconRes != 0) {
		Drawable drawable = ContextCompat.getDrawable(getContext(), iconRes);
		if (drawable != null) {
			drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
			mButton.setCompoundDrawables(drawable, null, null, null);
			mButton.setCompoundDrawablePadding(QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_action_drawable_padding));
		}

	}
	mButton.setMinHeight(0);
	mButton.setMinWidth(0);
	mButton.setMinimumWidth(0);
	mButton.setMinimumHeight(0);
	mButton.setClickable(false);
	mButton.setDuplicateParentStateEnabled(true);
	mButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(getContext(), R.attr.qmui_dialog_action_button_text_size));
	mButton.setTextColor(QMUIResHelper.getAttrColorStateList(getContext(), R.attr.qmui_dialog_action_text_color));

	addView(mButton);
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:42,代碼來源:QMUIDialogAction.java

示例14: setButtonRed

import android.widget.Button; //導入方法依賴的package包/類
/**
 * 改變bt顏色red設置可點擊
 *
 * @param bt
 */
private void setButtonRed(Button bt) {
    bt.setClickable(true);
    bt.setBackgroundResource(R.color.red);
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:10,代碼來源:IDCardVerifyActivity.java

示例15: setButtonGray

import android.widget.Button; //導入方法依賴的package包/類
/**
 * 改變bt顏色gray設置不可點擊
 *
 * @param bt
 */
private void setButtonGray(Button bt) {
    bt.setClickable(false);
    bt.setBackgroundResource(R.color.gray);
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:10,代碼來源:IDCardVerifyActivity.java


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