当前位置: 首页>>代码示例>>Java>>正文


Java Button.setTextColor方法代码示例

本文整理汇总了Java中android.widget.Button.setTextColor方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setTextColor方法的具体用法?Java Button.setTextColor怎么用?Java Button.setTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Button的用法示例。


在下文中一共展示了Button.setTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getButton

import android.widget.Button; //导入方法依赖的package包/类
private Button getButton(String text, int position) {

        // 动态生成选择按钮
        final Button button = new Button(mContext);
        button.setText(text);
        button.setTag(position);
        button.setTextColor(mBuilder.getItemTextColor());
        button.setTextSize(mBuilder.getItemTextSize());
        button.setLayoutParams(new LinearLayout.LayoutParams(AbsListView.LayoutParams
                .MATCH_PARENT, mBuilder.getItemHeight()));
        button.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {

                if (mBuilder.getOnItemListener() != null) {

                    selectPosition = Integer.parseInt(button.getTag().toString());
                    mBuilder.getOnItemListener().onItemClick(button, selectPosition);

                }
            }
        });

        return button;
    }
 
开发者ID:wp521,项目名称:MyFire,代码行数:27,代码来源:NormalSelectionDialog.java

示例2: setMdBtnStytle

import android.widget.Button; //导入方法依赖的package包/类
/**
 * 设置MD风格样式
 */
public static void setMdBtnStytle(BuildBean bean) {
    Button btnPositive =
            bean.alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
    Button btnNegative =
            bean.alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
    Button btnNatural =
            bean.alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
    if (btnPositive != null && btnNegative != null) {
        btnPositive.setTextSize(bean.btnTxtSize);
        btnNegative.setTextSize(bean.btnTxtSize);
        btnNatural.setTextSize(bean.btnTxtSize);
        if (bean.btn1Color != 0)
            btnPositive.setTextColor(getColor(null, bean.btn1Color));
        if (bean.btn2Color != 0)
            btnNegative.setTextColor(getColor(null, bean.btn2Color));
        if (bean.btn3Color != 0)
            btnNatural.setTextColor(getColor(null, bean.btn3Color));
    }
    Window window = bean.alertDialog.getWindow();
    window.setGravity(bean.gravity);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:ToolUtils.java

示例3: getEditTextDialog

import android.widget.Button; //导入方法依赖的package包/类
public AlertDialog getEditTextDialog(Context context, String title, final OnClickOkBtnListener mOnClickOkBtnListener) {
    this.mContext = context;
    et = (EditText) LayoutInflater.from(context).inflate(R.layout.layout_edittext, null);
    et.setSingleLine(true);
    AlertDialog mAlertDialog = new AlertDialog.Builder(mContext).setTitle(title)
            .setView(et)
            .setPositiveButton(mContext.getString(R.string.ok), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    String input = et.getText().toString();
                    if (null != mOnClickOkBtnListener) {
                        mOnClickOkBtnListener.onClickOk(input);
                    }

                }
            })
            .setNegativeButton(mContext.getString(R.string.cancel), null).show();
    Button btn1 = mAlertDialog.getButton(mAlertDialog.BUTTON_POSITIVE);
    btn1.setTextColor(context.getResources().getColor(R.color.colorPrimary));
    Button btn2 = mAlertDialog.getButton(mAlertDialog.BUTTON_NEGATIVE);
    btn2.setTextColor(context.getResources().getColor(R.color.colorPrimary));
    return mAlertDialog;
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:23,代码来源:DialogUtils.java

示例4: setNegativeButton

import android.widget.Button; //导入方法依赖的package包/类
/**
        * set negative button
        *
        * @param text the name of button
        */
       public void setNegativeButton(String text, final View.OnClickListener listener)
{
           Button button = new Button(mContext);
           LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
	LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
           button.setLayoutParams(params);
           button.setBackgroundResource(R.drawable.material_card);
           button.setText(text);
           button.setTextColor(Color.argb(222, 0, 0, 0));
           button.setTextSize(14);
           button.setGravity(Gravity.CENTER);
           button.setPadding(0, 0, 0, dip2px(8));
           button.setOnClickListener(listener);
           if (mButtonLayout.getChildCount() > 0)
    {
               params.setMargins(20, 0, 10, dip2px(BUTTON_BOTTOM));
               button.setLayoutParams(params);
               mButtonLayout.addView(button, 1);
           }
    else
    {
               button.setLayoutParams(params);
               mButtonLayout.addView(button);
           }
       }
 
开发者ID:stytooldex,项目名称:pius1,代码行数:31,代码来源:MaterialDialog.java

示例5: setButtonState

import android.widget.Button; //导入方法依赖的package包/类
public void setButtonState(Button button, boolean state)
{
    /* 팔로우 중인 유저인 경우 */
    if (state)
    {
        button.setText("팔로우 중");
        button.setBackgroundResource(R.drawable.view_follow_enable);
        button.setTextColor(context.getResources().getColor(android.R.color.white));
    }
    else
    {
        button.setText("팔로잉");
        button.setBackgroundResource(R.drawable.view_follow_disable);
        button.setTextColor(context.getResources().getColor(android.R.color.black));
    }
}
 
开发者ID:icaynia,项目名称:pracler,代码行数:17,代码来源:FindUserAdapter.java

示例6: beautyButtonGray

import android.widget.Button; //导入方法依赖的package包/类
protected void beautyButtonGray(Button mButton, String str, OnClickListener mOnClickListener) {
    mButton.setText(str);
    mButton.setTextSize(16.0f);
    mButton.setOnClickListener(mOnClickListener);
    SDKUtils.setBackground(mButton, this.crMgmt.getStatusDrawable("common_btn_gray_pressed", "common_btn_gray_normal", true));
    mButton.setTextColor(this.crMgmt.createSelector("#868b8f", "#000000"));
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:8,代码来源:BasicActivity.java

示例7: initView

import android.widget.Button; //导入方法依赖的package包/类
private void initView() {
    sobot_btn_take_photo = (Button) findViewById(ResourceUtils.getIdByName(getContext(), "id",
            "sobot_btn_take_photo"));
    sobot_btn_cancel = (Button) findViewById(ResourceUtils.getIdByName(getContext(), "id",
            "sobot_btn_cancel"));
    sobot_pop_layout = (LinearLayout) findViewById(ResourceUtils.getIdByName(getContext(), "id",
            "sobot_pop_layout"));
    sobot_btn_take_photo.setText(ResourceUtils.getIdByName(getContext(),"string","sobot_clear_history_message"));
    sobot_btn_take_photo.setTextColor(getContext().getResources()
            .getColor(ResourceUtils.getIdByName(getContext(), "color",
                    "sobot_text_delete_hismsg_color")));
    sobot_btn_take_photo.setOnClickListener(this);
    sobot_btn_cancel.setOnClickListener(this);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:15,代码来源:ClearHistoryDialog.java

示例8: viewForEmptyDataSet

import android.widget.Button; //导入方法依赖的package包/类
@Override
    public Button viewForEmptyDataSet(RelativeLayout layout,PHEmptyDataSet.TapNoDataType type) {
        Button btn = new Button(this);

        btn.setLayoutParams(new ViewGroup.LayoutParams(200,200));
//        Bitmap bitmap = BitmapFactory.decodeResource(res,R.drawable.m123);
        Drawable draw = new BitmapDrawable(getResources(),BitmapFactory.decodeResource(getResources(),R.drawable.m123));
        btn.setBackground(draw);
        btn.setText("goog");
        btn.setTextColor(Color.RED);
        btn.setTextSize((float)8.0);
        return btn;
    }
 
开发者ID:HeterPu,项目名称:PHEmptyDataSetForAndroid,代码行数:14,代码来源:MainActivity.java

示例9: showTimeDifference

import android.widget.Button; //导入方法依赖的package包/类
private static void showTimeDifference(Button delayView, Integer timeDifference, Context context) {
    apply(delayView, VISIBLE);
    delayView.setText(timeDifference + "'");
    if (timeDifference > 0) {
        delayView.setTextColor(getTimeDifferenceColor(context, ViewsUtils.COLORS.RED));
    } else {
        delayView.setTextColor(getTimeDifferenceColor(context, ViewsUtils.COLORS.GREEN));
    }
}
 
开发者ID:albertogiunta,项目名称:justintrain-client-android,代码行数:10,代码来源:FavouriteSolutionsItem.java

示例10: initView

import android.widget.Button; //导入方法依赖的package包/类
protected void initView(Context context) {
    mContext = context;
    LayoutInflater.from(mContext).inflate(R.layout.card_share, this);
    shareTV = (TextView) findViewById(R.id.share_msg);
    cancelBtn = (Button) findViewById(R.id.share_cancel);
    confirmBtn = (Button) findViewById(R.id.share_confirm);
    cancelBtn.setOnClickListener(myOnClickListener);
    confirmBtn.setOnClickListener(myOnClickListener);
    cancelBtn.setTextColor(getResources().getColor(R.color.text_color_import));
    refreshText();

}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:13,代码来源:IntroCard.java

示例11: refreshWordSelector

import android.widget.Button; //导入方法依赖的package包/类
public void refreshWordSelector()	{
LinkedList<String> listMatched = minputMethodCaller.matchFuncVars(mstrBuffered);
	mwordSelectionContainer.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, mnInputBtnHeight));		
mlLayoutWordSelectionBtnHolder.removeAllViews();
for (int idx = 0 ; idx < listMatched.size(); idx ++)	{
	String str = listMatched.get(idx);
	Button btn = new Button(getContext());
	btn.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, mnInputBtnHeight));
	btn.setTag(str);
	btn.setText(str);
	btn.setTextSize(TypedValue.COMPLEX_UNIT_PX, mfTextSize);
	int nTextColor = Color.RED;
	if (idx > 0)	{
		nTextColor = Color.GREEN;
	}
	btn.setTextColor(nTextColor);
	btn.setBackgroundResource(R.drawable.btn_background);
	btn.setOnClickListener(new OnClickListener()	{

		@Override
		public void onClick(View v) {
			minputMethodCaller.onClickSelectedWord((String)v.getTag());
		}
		
	});
	mlLayoutWordSelectionBtnHolder.addView(btn);
}	
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:29,代码来源:AMInputMethod.java

示例12: getButton

import android.widget.Button; //导入方法依赖的package包/类
private Button getButton(String text, int position) {

        // 动态生成选择按钮
        final Button button = new Button(mContext);
        button.setText(text);
        button.setTag(position);
        button.setTextColor(mBuilder.getItemTextColor());
        button.setTextSize(mBuilder.getItemTextSize());
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams
                .MATCH_PARENT, mBuilder.getItemHeight());
        button.setLayoutParams(lp);
        button.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
        button.setPadding(UiUtils.dp2px(mContext,10),0,UiUtils.dp2px(mContext,10),0);
        button.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {

                if (mBuilder.getOnItemListener() != null) {

                    selectPosition = Integer.parseInt(button.getTag().toString());
                    mBuilder.getOnItemListener().onItemClick(button, selectPosition);

                }
            }
        });

        return button;
    }
 
开发者ID:wp521,项目名称:MyFire,代码行数:30,代码来源:MDSelectionDialog.java

示例13: generateTopBarTextButton

import android.widget.Button; //导入方法依赖的package包/类
/**
 * 生成一个文本按钮,并设置文字
 *
 * @param text 按钮的文字
 * @return 返回生成的按钮
 */
private Button generateTopBarTextButton(String text) {
    Button button = new Button(getContext());
    button.setBackgroundResource(0);
    button.setMinWidth(0);
    button.setMinHeight(0);
    button.setMinimumWidth(0);
    button.setMinimumHeight(0);
    button.setPadding(mTopBarTextBtnPaddingHor, 0, mTopBarTextBtnPaddingHor, 0);
    button.setTextColor(mTopBarTextBtnTextColor);
    button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTopBarTextBtnTextSize);
    button.setGravity(Gravity.CENTER);
    button.setText(text);
    return button;
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:21,代码来源:QMUITopBar.java

示例14: setupMyRequests

import android.widget.Button; //导入方法依赖的package包/类
private void setupMyRequests() {
    Button btn1 = getDialog().findViewById(R.id.btn_1);
    Button btn2 = getDialog().findViewById(R.id.btn_2);
    Button btn3 = getDialog().findViewById(R.id.btn_3);

    if (mGoalCompleteResult != Goal.GoalCompleteResult.Pending) {
        btn1.setText(getString(R.string.fail));
        btn1.setTextColor(ContextCompat.getColor(getContext(), R.color.red));
        btn1.setTag(Goal.GoalCompleteResult.Failed);
        btn1.setOnClickListener(updateAction);

        btn2.setVisibility(View.VISIBLE);
        btn2.setText(getString(R.string.pass));
        btn2.setTextColor(ContextCompat.getColor(getContext(), R.color.green));
        btn2.setTag(Goal.GoalCompleteResult.Success);
        btn2.setOnClickListener(updateAction);

        btn3.setVisibility(View.VISIBLE);
        btn3.setText(getString(R.string.remind_friend));
        btn3.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
        btn3.setOnClickListener(remindAction);
    } else {
        btn1.setText(getString(R.string.accept));
        btn1.setTextColor(ContextCompat.getColor(getContext(), R.color.green));
        btn1.setTag(Goal.GoalCompleteResult.Ongoing);
        btn1.setOnClickListener(updateAction);

        btn2.setVisibility(View.GONE); //No decline for now until server adds implemention
        btn3.setVisibility(View.GONE);
    }
}
 
开发者ID:Q115,项目名称:Goalie_Android,代码行数:32,代码来源:GoalsDetailedDialog.java

示例15: themeButton

import android.widget.Button; //导入方法依赖的package包/类
public void themeButton(Button btn){
       if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		btn.setTextColor(getTextColor());
		btn.setBackgroundColor(getButtonBackgroundColor());
	}
}
 
开发者ID:HoraApps,项目名称:Liz,代码行数:7,代码来源:ThemeHelper.java


注:本文中的android.widget.Button.setTextColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。