List of usage examples for android.widget TextView setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:com.ehret.mixit.fragment.PeopleDetailFragment.java
private void addPeopleLink(Member membre) { //On vide les lments linkLayout.removeAllViews();/*from w w w . j a va 2 s .c o m*/ //On affiche les liens que si on a recuperer des choses if (membre != null && membre.getSharedLinks() != null && !membre.getSharedLinks().isEmpty()) { //On ajoute un table layout TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams( TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableLayout tableLayout = new TableLayout(getActivity().getBaseContext()); tableLayout.setLayoutParams(tableParams); if (mInflater != null && membre.getSharedLinks().size() > 0) { for (final Link link : membre.getSharedLinks()) { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText(Html.fromHtml(String.format("%s : <a href=\"%s\">%s</a>", link.getRel(), link.getHref(), link.getHref()))); link_text.setBackgroundColor(Color.TRANSPARENT); link_text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(link.getHref())); getActivity().startActivity(in); } }); tableLayout.addView(row); } } else { RelativeLayout row = (RelativeLayout) mInflater.inflate(R.layout.item_link, tableLayout, false); row.setBackgroundResource(R.drawable.row_transparent_background); //Dans lequel nous allons ajouter le contenu que nous faisons mapp dans TextView link_text = (TextView) row.findViewById(R.id.link_text); link_text.setText("Aucun lien"); link_text.setBackgroundColor(Color.TRANSPARENT); tableLayout.addView(row); } linkLayout.addView(tableLayout); } else { titleLinks.getLayoutParams().height = 0; } }
From source file:com.rachelgrau.rachel.health4theworldstroke.Activities.InfoActivity.java
public void addTextViewWithText(String text) { LinearLayout ll = (LinearLayout) findViewById(R.id.text_linear_layout); TextView secondPar = new TextView(this); secondPar.setText(text);//from w ww. j a v a 2 s. c o m secondPar.setPadding(40, 10, 40, 0); secondPar.setTextSize(14); secondPar.setBackgroundColor(Color.WHITE); ll.addView(secondPar); }
From source file:com.rachelgrau.rachel.health4theworldstroke.Activities.InfoActivity.java
public void addIndentedTextViewWithText(String text) { LinearLayout ll = (LinearLayout) findViewById(R.id.text_linear_layout); TextView secondPar = new TextView(this); secondPar.setText(text);/*from w w w . j av a 2 s.c o m*/ secondPar.setPadding(65, 10, 40, 0); secondPar.setTextSize(14); secondPar.setBackgroundColor(Color.WHITE); ll.addView(secondPar); }
From source file:com.yojiokisoft.yumekanow.activity.MakeCardActivity.java
/** * ????./*from w w w .ja v a2s .com*/ * * @param textView * @param backColor */ private void setBackAndForeColorLabel(TextView textView, int backColor) { int foreColor = backColor ^ 0xffffff; textView.setTextColor(foreColor); textView.setBackgroundColor(backColor); textView.setTag(backColor); String hex = String.format("%06x", backColor & 0x00ffffff); textView.setText("#" + hex); }
From source file:com.gh4a.activities.IssueCreateActivity.java
private void handleLabelClick(TextView tvLabel, Label label, boolean select) { Gh4Application app = Gh4Application.get(this); if (!select) { mSelectedLabels.remove(label);/* w ww.j a v a 2 s .c om*/ tvLabel.setTypeface(app.condensed); tvLabel.setBackgroundColor(0); tvLabel.setTextColor(getResources() .getColor(Gh4Application.THEME != R.style.LightTheme ? R.color.abs__primary_text_holo_dark : R.color.abs__primary_text_holo_light)); } else { int color = Color.parseColor("#" + label.getColor()); mSelectedLabels.add(label); tvLabel.setTypeface(app.boldCondensed); tvLabel.setBackgroundColor(color); tvLabel.setTextColor(UiUtils.textColorForBackground(this, color)); } }
From source file:com.sentaroh.android.Utilities.Dialog.MessageDialogFragment.java
private void initViewWidget() { if (DEBUG_ENABLE) Log.v(APPLICATION_TAG, "initViewWidget"); mDialog.setContentView(R.layout.common_dialog); ImageView title_icon = (ImageView) mDialog.findViewById(R.id.common_dialog_icon); TextView title = (TextView) mDialog.findViewById(R.id.common_dialog_title); LinearLayout title_view = (LinearLayout) mDialog.findViewById(R.id.common_dialog_title_view); title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color); ScrollView msg_view = (ScrollView) mDialog.findViewById(R.id.common_dialog_msg_view); msg_view.setBackgroundColor(mThemeColorList.dialog_msg_background_color); LinearLayout btn_view = (LinearLayout) mDialog.findViewById(R.id.common_dialog_btn_view); btn_view.setBackgroundColor(mThemeColorList.dialog_msg_background_color); if (mDialogTitleType.equals("I")) { title_icon.setImageResource(R.drawable.dialog_information); title.setTextColor(mThemeColorList.text_color_info); } else if (mDialogTitleType.equals("W")) { title_icon.setImageResource(R.drawable.dialog_warning); // title.setTextColor(Color.YELLOW); } else if (mDialogTitleType.equals("E")) { title_icon.setImageResource(R.drawable.dialog_error); // title.setTextColor(mThemeColorList.text_color_error); }//from w w w. jav a2s . c o m title.setTextColor(mThemeColorList.text_color_info); title.setText(mDialogTitle); TextView msg_text = (TextView) mDialog.findViewById(R.id.common_dialog_msg); if (mDialogMsgText.equals("")) msg_text.setVisibility(View.GONE); else { msg_text.setText(mDialogMsgText); msg_text.setTextColor(mThemeColorList.text_color_primary); msg_text.setBackgroundColor(mThemeColorList.dialog_msg_background_color); } final Button btnOk = (Button) mDialog.findViewById(R.id.common_dialog_btn_ok); final Button btnCancel = (Button) mDialog.findViewById(R.id.common_dialog_btn_cancel); if (mDialogTypeNegative) btnCancel.setVisibility(View.VISIBLE); else btnCancel.setVisibility(View.GONE); if (Build.VERSION.SDK_INT <= 10 && mThemeColorList.theme_is_light) { btnOk.setTextColor(mThemeColorList.text_color_info); btnCancel.setTextColor(mThemeColorList.text_color_info); } // CommonDialog.setDlgBoxSizeCompact(mDialog); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // mDialog.dismiss(); mFragment.dismiss(); if (mNotifyEvent != null) mNotifyEvent.notifyToListener(true, null); } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // mDialog.dismiss(); mFragment.dismiss(); if (mNotifyEvent != null) mNotifyEvent.notifyToListener(false, null); } }); }
From source file:iit.iitrc.rahil.cognizance_2016.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null;/*from w w w . j av a 2 s . c o m*/ TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); tabTitleView.setBackgroundColor(Color.BLACK); tabTitleView.setTextSize(20); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:com.taobao.weex.extend.module.actionsheet.WXActionSheet.java
private TextView createItemBase() { TextView textView = new TextView(getActivity()); textView.setBackgroundColor(Color.WHITE); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(18)); return textView; }
From source file:com.rachelgrau.rachel.health4theworldstroke.Activities.InfoActivity.java
public void addHeaderWithText(String text) { LinearLayout ll = (LinearLayout) findViewById(R.id.text_linear_layout); TextView textView = new TextView(this); textView.setTypeface(null, Typeface.BOLD); textView.setText(text);// w w w. ja va 2s . c o m textView.setPadding(40, 40, 40, 10); textView.setTextSize(20); textView.setBackgroundColor(Color.WHITE); ll.addView(textView); }
From source file:com.hector.invoice.views.TabExportInvoiceOrder.java
/** * Mo ta chuc nang cua ham/*from w w w . j a v a 2s. co m*/ * * @author: TamPQ * @param context * @param tabName * @param type * @return * @return: View * @throws: */ private View createTabView(Context context, String tabName, int type) { TextView tvTitleTab = (TextView) LayoutInflater.from(context).inflate(R.layout.tab_item_top, null); // ImageView ivNumPage = (ImageView) view.findViewById(R.id.ivNumPage); switch (type) { case Constants.TAB_EXPORT_RECHNUNG: tvTitleTab.setText("Rechnung"); if (!tvTitleTab.isSelected()) { tvTitleTab.setBackgroundColor(ImageUtil.getColor(R.color.TRANSPARENT)); } else { tvTitleTab.setBackgroundResource(R.drawable.bg_button_green); } break; case Constants.TAB_EXPORT_LIEFERSCHEIN: tvTitleTab.setText("Lieferschein"); if (!tvTitleTab.isSelected()) { tvTitleTab.setBackgroundColor(ImageUtil.getColor(R.color.TRANSPARENT)); } else { tvTitleTab.setBackgroundResource(R.drawable.bg_button_green); } break; case Constants.TAB_EXPORT_ANGEBOT: tvTitleTab.setText("Angebot"); if (!tvTitleTab.isSelected()) { tvTitleTab.setBackgroundColor(ImageUtil.getColor(R.color.TRANSPARENT)); } else { tvTitleTab.setBackgroundResource(R.drawable.bg_button_green); } break; default: break; } return tvTitleTab; }