List of usage examples for android.widget TextView setTextColor
@android.view.RemotableViewMethod public void setTextColor(ColorStateList colors)
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * SINGLE TITLE ROW/*from w ww . j a v a 2s . c o m*/ * @param att * @param linear * @return */ public LinearLayout getSingleTitleRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setMinimumHeight(30); container_layout .setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo_blue)); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView tx = new TextView(context); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value_params); LinearLayout.LayoutParams ltext1 = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView t1 = new TextView(context); t1.setText(att.get("value")); t1.setTextSize(11); t1.setGravity(Gravity.CENTER_HORIZONTAL); t1.setPadding(2, 0, 0, 2); t1.setTextColor(Color.rgb(255, 255, 255)); container_layout.addView(t1, ltext1); linear.addView(container_layout); return linear; }
From source file:com.achep.acdisplay.ui.fragments.dialogs.SetupPermissionsDialog.java
@NonNull @Override/* w w w . j av a2 s . c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { Context context = getActivity(); assert context != null; View view = new DialogBuilder(context).setTitle(R.string.permissions_dialog_title) .setView(R.layout.dialog_permissions).createSkeletonView(); // Make title more red TextView title = (TextView) view.findViewById(R.id.title); title.setTextColor(title.getCurrentTextColor() & 0xFFFF3333 | 0xFF << 16); ListView listView = (ListView) view.findViewById(R.id.list); mAdapter = new Adapter(context, new ArrayList<Item>()); listView.setAdapter(mAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Adapter adapter = (Adapter) parent.getAdapter(); Item item = adapter.getItem(position); item.run(); } }); return new AlertDialog.Builder(context).setView(view).setNeutralButton(R.string.later, null).create(); }
From source file:audio.lisn.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./*w ww .j av a 2s.c o m*/ */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.WHITE); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.chalmers.schmaps.CheckBusActivity.java
/** * Makes the rows for the chalmerstable/* w w w .ja v a 2s .c o m*/ */ public void makeChalmersRows() { for (int i = 0; i < NROFROWS; i++) { TableRow tempTableRow = new TableRow(this); tempTableRow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); // Makes every other row light gray or white if (i % 2 == 0) { tempTableRow.setBackgroundColor(getResources().getColor(R.color.transp_grey)); } else { tempTableRow.setBackgroundColor(getResources().getColor(R.color.transp_white)); } //Makes every textview for each column and add it before starting with a new one for (int j = 0; j < NR_OF_COLUMNS; j++) { TextView textview = new TextView(this); textview.setTextColor(Color.BLACK); textview.setTextSize(TypedValue.COMPLEX_UNIT_SP, TEXT_SIZE); //Check which content should be written in the textview if (j == COLUMN_NR_1) { textview.setText(chalmersLineArray.get(i)); } else if (j == COLUMN_NR_2) { textview.setText(chalmersDestArray.get(i)); } else if (j == COLUMN_NR_3) { textview.setText(chalmersTimeArray.get(i)); } else if (j == COLUMN_NR_4) { textview.setText(chalmersTrackArray.get(i)); } textview.setGravity(Gravity.CENTER_HORIZONTAL); tempTableRow.addView(textview); } chalmersTable.addView(tempTableRow, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } }
From source file:com.chalmers.schmaps.CheckBusActivity.java
/** * Makes the rows for the lindholmentable *//*from www .ja v a2 s . c o m*/ public void makeLindholmenRows() { for (int i = 0; i < NROFROWS; i++) { TableRow tempTableRow = new TableRow(this); tempTableRow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); // Makes every other row light gray or white if (i % 2 == 0) { tempTableRow.setBackgroundColor(getResources().getColor(R.color.transp_grey)); } else { tempTableRow.setBackgroundColor(getResources().getColor(R.color.transp_white)); } //Makes every textview for each column and add it before starting with a new one for (int j = 0; j < NR_OF_COLUMNS; j++) { TextView textview = new TextView(this); textview.setTextColor(Color.BLACK); textview.setTextSize(TypedValue.COMPLEX_UNIT_SP, TEXT_SIZE); //Check which content should be written in the textview if (j == COLUMN_NR_1) { textview.setText(lindholmenLineArray.get(i)); } else if (j == COLUMN_NR_2) { textview.setText(lindholmenDestArray.get(i)); } else if (j == COLUMN_NR_3) { textview.setText(lindholmenTimeArray.get(i)); } else if (j == COLUMN_NR_4) { textview.setText(lindholmenTrackArray.get(i)); } textview.setGravity(Gravity.CENTER_HORIZONTAL); tempTableRow.addView(textview); } lindholmenTable.addView(tempTableRow, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } }
From source file:com.autogermany.opel360.Utils.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./*from w ww.ja v a2 s . co m*/ */ @SuppressLint("NewApi") protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.parseColor("#FFFFFF")); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.ashoksm.pinfinder.common.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from ww w . ja va 2 s.co m */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.parseColor("#99ffffff")); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.av.benzandroid.views.SlidingTabLayout.java
private void scrollToTab(int tabIndex, int positionOffset) { final int tabStripChildCount = mTabStrip.getChildCount(); if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { return;/*from w ww. j a v a 2 s .c o m*/ } View selectedChild = mTabStrip.getChildAt(tabIndex); if (selectedChild != null) { int targetScrollX = selectedChild.getLeft() + positionOffset; if (tabIndex > 0 || positionOffset > 0) { // If we're not at the first child and are mid-scroll, make sure we obey the offset targetScrollX -= mTitleOffset; } //Elv - Reinitialize color of tabs for (int i = 0; i < mTabStrip.getChildCount(); i++) { if (tabIndex == i) { //Set text colot of current selected tab ((TextView) selectedChild).setTextColor(SELECTED_TEXTVIEW_COLOR); } else { TextView tab = (TextView) mTabStrip.getChildAt(i); tab.setTextColor(DEFAULT_TEXTVIEW_COLOR); } } scrollTo(targetScrollX, 0); } }
From source file:com.brianwu.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from ww w . j a v a 2s . c om */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(context.getResources().getColor(R.color.txt_gray_white)); textView.setTextSize(16); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); int rlPadding = (int) (12 * getResources().getDisplayMetrics().density); textView.setPadding(rlPadding, padding, rlPadding, padding); return textView; }
From source file:com.dedipower.portal.android.ViewTicket.java
public void UpdateErrorMessage(String MessageText) { TextView ErrorMessage = (TextView) findViewById(R.id.ErrorMessageText); if (MessageText.length() == 0) { ErrorMessage.setHeight(0);/* w ww .j av a2 s. c om*/ } else { ErrorMessage.setTextColor(-65536); ErrorMessage.setText(MessageText); } }