当前位置: 首页>>代码示例>>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;未经允许,请勿转载。