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


Java TextView.setTextColor方法代码示例

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


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

示例1: showLoading

import android.widget.TextView; //导入方法依赖的package包/类
public LoadingView showLoading(CharSequence msg, boolean cancleabl) {

        mDialog = new Dialog(mContext);// TODO: 2017/8/28 内存泄露时这里也修改为弱引用
        mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

        rootView = View.inflate(mContext, R.layout.dialogui_loading_horizontal, null);
        mLinearLayout = (LinearLayout) rootView.findViewById(R.id.dialogui_ll_bg);
        mProgressBar = (ProgressBar) rootView.findViewById(R.id.pb_bg);
        mTextView = (TextView) rootView.findViewById(R.id.dialogui_tv_msg);
        mTextView.setText(msg);
        mLinearLayout.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
        mProgressBar.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
        mTextView.setTextColor(mContext.getResources().getColor(R.color.text_black));
        mDialog.setContentView(rootView);

        if (mDialog != null) {
            if (mDialog.isShowing()) {
                mDialog.dismiss();
            }
            mDialog.setCancelable(cancleabl);
            mDialog.setOnCancelListener(this);
            mDialog.show();
        }
        return this;
    }
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:26,代码来源:LoadingView.java

示例2: createTitle

import android.widget.TextView; //导入方法依赖的package包/类
private TextView createTitle(SwipeMenuItem item) {
	TextView tv = new TextView(getContext());
	tv.setText(item.getTitle());
	tv.setGravity(Gravity.CENTER);
	tv.setTextSize(item.getTitleSize());
	tv.setTextColor(item.getTitleColor());
	return tv;
}
 
开发者ID:ebridfighter,项目名称:GongXianSheng,代码行数:9,代码来源:SwipeMenuView.java

示例3: onBindViewHolder

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Rule rule = activity.rules.get(position);
    holder.text.setText(rule.appName);
    holder.edit.setVisibility(View.GONE);
    Drawable appIcon;
    try {
        appIcon = pm.getApplicationIcon(rule.appPkg);
        appIcon.setBounds(0, 0, Util.dpToPx(activity, 25),
                Util.dpToPx(activity, 25));
    } catch (PackageManager.NameNotFoundException e) {
        appIcon = null;
    }
    holder.text.setCompoundDrawables(appIcon, null, null, null);
    holder.linearLayout.removeAllViews();
    for (int i = 0; i < rule.lightSettings.lights.length; i++) {
        TextView light = (TextView) inflater
                .inflate(R.layout.light, holder.linearLayout, false);
        int lightIcon;
        if (activity.lights != null && activity.lights.containsKey(
                String.valueOf(rule.lightSettings.lights[i]))) {
            Light lightObject = activity.lights.get(
                    String.valueOf(rule.lightSettings.lights[i]));
            light.setText(lightObject.name);
            lightIcon = Util.getLightIcon(lightObject.modelid);
        } else {
            light.setText("Light #" + rule.lightSettings.lights[i]);
            lightIcon = R.drawable.ic_light;
        }
        light.setCompoundDrawablesWithIntrinsicBounds(lightIcon, 0, 0, 0);
        if (Build.VERSION.SDK_INT >= 23) {
            API23Wrapper.setCompoundDrawableTintList(light, rule.lightSettings.colors[i]);
        }
        light.setTextColor(rule.lightSettings.colors[i]);
        holder.linearLayout.addView(light);
    }
}
 
开发者ID:j4velin,项目名称:HueNotifier,代码行数:38,代码来源:RuleAdapter.java

示例4: show_info

import android.widget.TextView; //导入方法依赖的package包/类
public void show_info(View view) {
    // add more Build Info
    final StringBuilder sb = new StringBuilder();
    Tinker tinker = Tinker.with(getApplicationContext());
    if (tinker.isTinkerLoaded()) {
        sb.append(String.format("[patch is loaded] \n"));
        sb.append(String.format("[buildConfig TINKER_ID] %s \n", BuildInfo.TINKER_ID));
        sb.append(String.format("[buildConfig BASE_TINKER_ID] %s \n", BaseBuildInfo.BASE_TINKER_ID));

        sb.append(String.format("[buildConfig MESSSAGE] %s \n", BuildInfo.MESSAGE));
        sb.append(String.format("[TINKER_ID] %s \n", tinker.getTinkerLoadResultIfPresent().getPackageConfigByName(ShareConstants.TINKER_ID)));
        sb.append(String.format("[packageConfig patchMessage] %s \n", tinker.getTinkerLoadResultIfPresent().getPackageConfigByName("patchMessage")));
        sb.append(String.format("[TINKER_ID Rom Space] %d k \n", tinker.getTinkerRomSpace()));

    } else {
        sb.append(String.format("[patch is not loaded] \n"));
        sb.append(String.format("[buildConfig TINKER_ID] %s \n", BuildInfo.TINKER_ID));
        sb.append(String.format("[buildConfig BASE_TINKER_ID] %s \n", BaseBuildInfo.BASE_TINKER_ID));

        sb.append(String.format("[buildConfig MESSSAGE] %s \n", BuildInfo.MESSAGE));
        sb.append(String.format("[TINKER_ID] %s \n", ShareTinkerInternals.getManifestTinkerID(getApplicationContext())));
    }
    sb.append(String.format("[BaseBuildInfo Message] %s \n", BaseBuildInfo.TEST_MESSAGE));

    final TextView v = new TextView(this);
    v.setText(sb);
    v.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    v.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
    v.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    v.setTextColor(0xFF000000);
    v.setTypeface(Typeface.MONOSPACE);
    final int padding = 16;
    v.setPadding(padding, padding, padding, padding);

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(true);
    builder.setView(v);
    final AlertDialog alert = builder.create();
    alert.show();
}
 
开发者ID:GitLqr,项目名称:HotFixDemo,代码行数:41,代码来源:MainActivity.java

示例5: buildTextView

import android.widget.TextView; //导入方法依赖的package包/类
private TextView buildTextView(Context context, CharSequence text) {
    TextView textView = new TextView(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    textView.setLayoutParams(params);
    textView.setTextColor(mTextColor);
    textView.setText(text);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSize);
    textView.setMaxLines(3);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(Gravity.CENTER);
    textView.setPadding(mPaddingHorizontal, mPaddingVertical, mPaddingHorizontal, mPaddingVertical);
    return textView;
}
 
开发者ID:TechIsFun,项目名称:SlidingSwitch,代码行数:14,代码来源:SlidingSwitch.java

示例6: findViews

import android.widget.TextView; //导入方法依赖的package包/类
private void findViews() {
    TextView notifyText = ((TextView) findView(R.id.notify_bar).findViewById(R.id.status_desc_label));
    notifyText.setText(R.string.black_list_tip);
    notifyText.setBackgroundColor(getResources().getColor(R.color.color_yellow_fcf3cd));
    notifyText.setTextColor(getResources().getColor(R.color.color_yellow_796413));
    listView = findView(R.id.black_list_view);
    adapter = new BlackListAdapter(this, data, this, viewHolderEventListener);
    listView.setAdapter(adapter);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:10,代码来源:BlackListActivity.java

示例7: BottomSheetCell

import android.widget.TextView; //导入方法依赖的package包/类
public BottomSheetCell(Context context, int type) {
    super(context);

    setBackgroundResource(R.drawable.list_selector);
    setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    if (type == 0) {
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
    } else if (type == 1) {
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
        textView.setTypeface(FontManager.instance().getTypeface());
        addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:28,代码来源:BottomSheet.java

示例8: getGroupView

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * Get the text display for a specified habit category in the list
 * @param i the index of the habit category
 * @param b (unused)
 * @param view (unused)
 * @param parent (unused)
 * @return the view displaying the specified habit category in the list
 */
@Override
public View getGroupView(int i, boolean b, View view, ViewGroup parent) {
    TextView textView = new TextView(context);
    textView.setText((String)getGroup(i));
    textView.setPadding(100, 36, 10, 36);
    textView.setTextColor(Color.BLACK);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    return textView;
}
 
开发者ID:CMPUT301F17T15,项目名称:CIA,代码行数:18,代码来源:ExpandableListViewAdapter.java

示例9: OnControlActivatedEvent

import android.widget.TextView; //导入方法依赖的package包/类
private void OnControlActivatedEvent(TextView label, boolean down) {
    if (down) {
        label.setTextColor(getResources().getColor(R.color.text_color_highlighted));
    }
    else {
        label.setTextColor(getResources().getColor(R.color.text_color));
    }
}
 
开发者ID:peter10110,项目名称:Android-SteamVR-controller,代码行数:9,代码来源:ControllerFragment.java

示例10: TextInfoCell

import android.widget.TextView; //导入方法依赖的package包/类
public TextInfoCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(0xffa3a3a3);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    textView.setGravity(Gravity.CENTER);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setPadding(0, AndroidUtilities.dp(19), 0, AndroidUtilities.dp(19));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 17, 0, 17, 0));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:12,代码来源:TextInfoCell.java

示例11: setTextColor

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * 设置文本颜色
 */
public void setTextColor(@ColorInt int color)
{
    this.textColor = color;
    for(TextView tv : list)
    {
        tv.setTextColor(color);
    }
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:12,代码来源:AuthEditText.java

示例12: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_counter);

    tv = (TextView) findViewById(R.id.textView3);
    tv.setText(getIntent().getStringExtra("msg"));
    tv.setTextColor(Color.WHITE);
}
 
开发者ID:lmartire,项目名称:DoApp,代码行数:10,代码来源:CounterActivity.java

示例13: FriendListItem

import android.widget.TextView; //导入方法依赖的package包/类
public FriendListItem(Context context, float ratio) {
	super(context);
	int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
	setPadding(itemPadding, 0, itemPadding, 0);
	setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
	setBackgroundColor(0xffffffff);

	ivCheck = new ImageView(context);
	LayoutParams lp = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	addView(ivCheck, lp);

	aivIcon = new AsyncImageView(context);
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.setMargins(avatarMargin, 0, avatarMargin, 0);
	addView(aivIcon, lp);

	tvName = new TextView(context);
	tvName.setTextColor(0xff000000);
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvName.setSingleLine();
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	lp.weight = 1;
	addView(tvName, lp);

	int resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_check_checked");
	if (resId > 0) {
		bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
	}
	resId = ResHelper.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
	if (resId > 0) {
		bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
	}
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:40,代码来源:FriendListItem.java

示例14: showNetworkError

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void showNetworkError() {
    if (connProblemSnack == null) {
        connProblemSnack = TSnackbar.make(recyclerView,
                R.string.main_connection_problem, TSnackbar.LENGTH_SHORT);
        connProblemSnack.getView().setBackgroundColor(getResources()
                .getColor(R.color.main_screen_connection_problem_background));
        TextView message = (TextView) connProblemSnack.getView()
                .findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text);
        message.setTextColor(getResources().getColor(R.color.main_screen_connection_problem_text));
        message.setGravity(Gravity.CENTER);
    }
    connProblemSnack.show();
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:15,代码来源:PublicDialogsFragment.java

示例15: getView

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	View row = convertView;

       if(row == null) {
           LayoutInflater inflater = ((Activity)context).getLayoutInflater();
           row = inflater.inflate(layoutResourceId, parent, false);
       }

       Typeface font = FontManager.getInstance().getFont(FontManager.Font.ROBOTO_LIGHT);
       TextView title = (TextView) row.findViewById(R.id.achievement_title);
       title.setTypeface(font);
       ImageView icon = (ImageView) row.findViewById(R.id.achievement_icon);

       title.setText(achievements[position].getHeading());

       if(achievements[position].checkAchievement()) {
           icon.setImageResource(achievements[position].getIconUnlockedID());
           title.setTextColor(Color.BLACK);
       }
   	else {
           icon.setImageResource(achievements[position].getIconLockedID());
           title.setTextColor(context.getResources().getColor(R.color.text_gray));
       }

       return row;
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:28,代码来源:AchievementAdapter.java


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