Best code examples for TextView setTextSize method (android.widget.TextView.setTextSize)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView setTextSize method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

TextView setTextSize examples from Open Source projects
This code example shows how to use the following methods: setPadding, setText, setTextColor, setTextSize
174:	textView.setPadding((int)(20 * scale) * (leftPadding ? 2 : 1), (int)(20 * scale) * (!leftPadding && topPadding ? 1 : 0), (int)(20 * scale), 0); 
175:	textView.setText(item); 
176:	textView.setTextColor(Color.BLACK); 
177:	textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setGravity, setPadding, setText, setTextSize
65:	TextView scoreText = new TextView(parent.getContext()); 
66:	scoreText.setText(String.valueOf(score.getScore())); 
67:	scoreText.setGravity(Gravity.RIGHT); 
68:	scoreText.setPadding(10, 10, 10, 10); 
69:	scoreText.setTextSize(16); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextColor, setTextSize, getHeight
94:	TextView textView = new TextView(context); 
95:	textView.setText(prompt); 
96:	textView.setTextSize(14); 
97:	textView.setTextColor(Color.BLACK); 
-
104:	LinearLayout.LayoutParams.WRAP_CONTENT,textView.getHeight()); 
-
108:	textView.setGravity(Gravity.CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize, setLayoutParams
69:	textView = new TextView(context); 
70:	textView.setTextSize(16); 
71:	textView.setTextColor(0xffffffff); 
72:	textView.setText(textId); 
73:	textView.setLayoutParams(new LinearLayout.LayoutParams( 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, setMaxWidth, setMinWidth, setPadding, setText
66:	TextView messageText = new TextView(parent.getContext()); 
67:	messageText.setText(this.getMessageText(pos)); 
68:	messageText.setGravity(Gravity.LEFT); 
69:	messageText.setPadding(10, 10, 10, 10); 
70:	messageText.setMaxWidth(200); 
71:	messageText.setMinWidth(200); 
72:	messageText.setTextSize(16); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextColor, setTextSize, setTypeface
58:	final TextView title = new TextView(getContext()); 
59:	title.setText(getTitle()); 
60:	title.setTextSize(24); 
61:	title.setTextColor(Color.WHITE); 
62:	title.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); 
63:	title.setGravity(Gravity.LEFT); 
64:	title.setLayoutParams(titleparams); 
65:	title.setId(TITLE_ID); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextSize, setTypeface, setLayoutParams
42:	tvFormattedName.setText("Add " + bookmark.getName()); 
43:	tvFormattedName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); 
44:	tvFormattedName.setTypeface(Typeface.DEFAULT_BOLD); 
-
48:	tvFormattedName.setLayoutParams(para); 
-
58:	tvFormattedName.setText("[" + bookmark.getObjectType() + "] " + bookmark.getName()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setSingleLine, setText, setTextColor, setTextSize, setTypeface
166:	textView = new TextView(getContext()); 
167:	textView.setSingleLine(true); 
-
173:	textView.setText(text); 
-
177:	textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize); 
-
180:	textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11); 
-
183:	textView.setTypeface(Typeface.DEFAULT_BOLD); 
184:	textView.setTextColor((textColor == null) ? DEFAULT_TEXT_COLOR : textColor); 
185:	textView.setLayoutParams(textParams); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setLines, setTextColor, setTextSize, setTypeface
222:	view.setTextColor(textColor); 
223:	view.setGravity(Gravity.CENTER); 
224:	view.setTextSize(textSize); 
225:	view.setLines(1); 
226:	view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getText, length, setText, setTextColor, setTextSize
182:	TextView tv = new TextView(this); 
-
187:	tv.setLayoutParams(lp); 
-
189:	tv.setText(info.activityInfo.loadLabel(getPackageManager())); 
190:	tv.setTextColor(Color.BLACK); 
191:	tv.setTextSize(15); 
-
194:	tv.setText(tv.getText(), TextView.BufferType.SPANNABLE); 
195:	Spannable str = (Spannable) tv.getText(); 
-
200:	0, tv.length(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setLines, setTextColor, setTextSize, setTypeface
239:	view.setTextColor(textColor); 
240:	view.setGravity(Gravity.CENTER); 
241:	view.setTextSize(textSize); 
242:	view.setLines(1); 
-
245:	view.setTypeface(textTypeface); 
-
247:	view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextColor, setTextSize, setTypeface
76:	final TextView title = new TextView(getContext()); 
77:	title.setText(getTitle()); 
78:	title.setTextSize(24); 
79:	title.setTextColor(Color.WHITE); 
80:	title.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); 
81:	title.setGravity(Gravity.LEFT); 
82:	title.setLayoutParams(titleparams); 
83:	title.setId(TITLE_ID); 
-
90:	descriptionparams.addRule(RelativeLayout.BELOW, title.getId()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTextSize, setTypeface
170:	m_label.setTypeface(aTypeface); 
171:	m_label.setTextSize(aSize); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextSize
13:	TextView textView = new TextView(this); 
14:	textView.setText("Activity two"); 
15:	textView.setGravity(Gravity.CENTER); 
16:	textView.setTextSize(48); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText, setTextSize, setMinimumHeight, setMinimumWidth, setOnClickListener
61:	button = new Button(mContext); 
62:	button.setMinimumWidth(300); 
63:	button.setMinimumHeight(70); 
64:	button.setTextSize(14); 
65:	button.setText("Play sample"); 
66:	button.setOnClickListener(buttonListener); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize
53:	mValueText = new TextView(mContext); 
54:	mValueText.setGravity(Gravity.CENTER_HORIZONTAL); 
55:	mValueText.setTextSize(32); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize
149:	TextView textView = new TextView(mContext); 
150:	textView.setTextColor(mInactiveTextColor.getColor()); 
151:	textView.setTextSize(16); 
152:	textView.setText(label); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getPaintFlags, getTypeface, setTextSize
119:	Typeface tf = mColumn1.getTypeface(); 
-
123:	+ " S=" + ((mColumn1.getPaintFlags() & Paint.SUBPIXEL_TEXT_FLAG) != 0 ? 1 : 0) 
-
313:	mColumn1.setTextSize(mFontSize); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize
78:	mValueText = new TextView(mContext); 
79:	mValueText.setGravity(Gravity.CENTER_HORIZONTAL); 
80:	mValueText.setTextSize(32); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize, setTypeface
50:	TextView telop = new TextView(this); 
51:	telop.setText("TextViewをVideoViewに重ねます"); 
52:	telop.setTextColor(Color.RED); 
53:	telop.setTextSize(40); 
54:	telop.setTypeface(Typeface.DEFAULT, 1); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize, setLayoutParams
29:	mTextView = new TextView(context); 
30:	mTextView.setLayoutParams(new LayoutParams( 
-
32:	mTextView.setGravity(Gravity.CENTER_HORIZONTAL 
-
34:	mTextView.setTextSize(18.0f); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTextSize, setTypeface
172:	title.setTypeface(aTypeface); 
173:	title.setTextSize(aSize); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextColor, setTextSize
22:	TextView textView = new TextView(context); 
23:	textView.setTextSize(14.0f); 
-
25:	textView.setText(inode.getDisplayName()); 
26:	textView.setGravity(Gravity.CENTER); 
-
34:	textView.setTextColor(Color.WHITE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize
112:	valueTextView = new TextView(context); 
113:	valueTextView.setGravity(Gravity.CENTER_HORIZONTAL); 
114:	valueTextView.setTextSize(32); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTextColor, setTextSize, setTypeface, setLayoutParams
100:	mText = new TextView(mContext); 
101:	mText.setTextColor(0xFF8F8F8F); 
102:	mText.setTextSize(12); 
103:	mText.setTypeface(Typeface.DEFAULT_BOLD); 
104:	mText.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize, setLayoutParams
36:	mTextView = new TextView(context); 
37:	mTextView.setLayoutParams(new LayoutParams( 
-
39:	mTextView.setGravity(Gravity.CENTER_HORIZONTAL 
-
41:	mTextView.setTextSize(18.0f); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTextSize, setTypeface
203:	textView.setTypeface(aTypeface); 
204:	textView.setTextSize(aSize); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize
51:	mValueText = new TextView(mContext); 
52:	mValueText.setGravity(Gravity.CENTER_HORIZONTAL); 
53:	mValueText.setTextSize(32); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setPadding, setText, setTextSize, setTag
278:	TextView label = new TextView(this); 
279:	label.setTag(id); 
280:	label.setText(value); 
281:	label.setTextSize(20); 
282:	label.setPadding(0, 5, 0, 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextColor, setTextSize, setBackgroundColor
31:	TextView v = new TextView(getActivity()); 
32:	v.setGravity(Gravity.CENTER); 
33:	v.setTextSize(40); 
34:	v.setTextColor(Color.BLACK); 
35:	v.setBackgroundColor(colour); 
36:	v.setText("Fragment ID: " + identifier); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setPadding, setText, setTextColor, setTextSize
39:	TextView tv = new TextView(context); 
40:	tv.setPadding(10, 10, 10, 10); 
41:	tv.setGravity(Gravity.CENTER_HORIZONTAL); 
42:	tv.setTextSize(20); 
43:	tv.setText(obj.toString()); 
44:	tv.setTextColor(0xaaffffff); 
-
47:	tv.setTypeface(font); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getText, setPadding, setTextColor, setTextSize
111:	final String option = tv.getText().toString(); 
-
119:	tv.setTextSize(24.0f); 
-
124:	tv.setTextColor(Color.BLACK); 
125:	tv.setPadding(10, 3, 3, 3); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getTextSize, setTextSize
178:	float fontPixelSize = view.getTextSize(); 
-
182:	view.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontPixelSize*ratio); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setPadding, setTextSize, setTypeface, setId
44:	textView = new TextView(getContext()); 
45:	textView.setId(android.R.id.title); 
46:	textView.setPadding(padding,padding,padding,padding); 
-
49:	textView.setTextSize(textSize); 
-
52:	textView.setTypeface(null, Typeface.BOLD_ITALIC); 
-
54:	textView.setTypeface(null, Typeface.BOLD); 
-
56:	textView.setTypeface(null, Typeface.ITALIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setShadowLayer, setSingleLine, setTextColor, setTextSize, setTypeface
114:	dateTextView = new TextView(context); 
115:	dateTextView.setId(DATE_TEXT_VIEW_ID); 
-
122:	dateTextView.setLayoutParams(params); 
123:	dateTextView.setShadowLayer(1, 0, 1, Color.WHITE); 
124:	dateTextView.setSingleLine(true); 
125:	dateTextView.setTextColor(Color.GRAY); 
126:	dateTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); 
127:	dateTextView.setTypeface(null, Typeface.ITALIC); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTextSize, setLayoutParams
41:	TextView label = new TextView( activity ); 
-
50:	label.setLayoutParams( labelParams ); 
-
52:	label.setTextSize( 15.0f ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setTextSize
74:	TextView t = new TextView(this); 
75:	t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); 
76:	t.setTextSize(36); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize
189:	textView = new TextView(getContext()); 
190:	textView.setText(localizationService.getString(displayTextKey)); 
191:	textView.setTextColor(txtColor); 
192:	textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setPadding, setText, setTextSize, setLayoutParams
45:	final TextView currentRow = new TextView(mContext); 
46:	currentRow.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT)); 
47:	currentRow.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); 
48:	currentRow.setPadding(24, 10, 0, 10); 
49:	currentRow.setText(mEvents.get(position).getmTitle()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setPadding, setTextSize
53:	mFieldType = new TextView(context); 
54:	mFieldType.setTextSize(16); 
55:	mFieldType.setPadding(4, 4, 4, 8); 
56:	mFieldType.setGravity(Gravity.RIGHT); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setPadding, setTextColor, setTextSize
63:	mLabel = new TextView(getContext()); 
-
85:	mLabel.setPadding(0, 0, 0, new Float(padding).intValue()); 
86:	mLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.0f); 
87:	mLabel.setTextColor(sUnselectedTextColor); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextSize, setLayoutParams
159:	this.tvColorLabel = new TextView(getContext()); 
160:	this.tvColorLabel.setText(this.mColorLabelText); 
161:	this.tvColorLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, DEFAULT_LABEL_TEXT_SIZE_SP); 
162:	this.tvColorLabel.setGravity(Gravity.BOTTOM | Gravity.LEFT); 
163:	this.tvColorLabel.setLayoutParams(lp2); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextSize, setLayoutParams
60:	TextView t = new TextView(mContext); 
61:	t.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); 
62:	t.setText(mData[position]); 
63:	t.setTextSize(30); 
64:	t.setGravity(Gravity.CENTER); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize, setLayoutParams
163:	TextView title = new TextView(this); 
164:	title.setText("授权"); 
165:	title.setTextColor(Color.WHITE); 
166:	title.setTextSize(24f); 
-
170:	title.setLayoutParams(titleParams); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize, setBackgroundDrawable, setId
176:	Button button = new Button(context); 
177:	button.setId(UPDATE_BUTTON_ID); 
-
186:	button.setLayoutParams(params); 
187:	button.setBackgroundDrawable(getButtonSelector()); 
188:	button.setText("Update"); 
189:	button.setTextColor(Color.WHITE); 
190:	button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTextSize, setLayoutParams
137:	edtIpAddress = new EditText(this); 
138:	edtIpAddress.setTextSize(12.0f); 
-
141:	edtIpAddress.setLayoutParams(p); 
Full Snippet Info
6
CodeRank
Related TextView setTextSize Questions & Answers:
Displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; see EditText for a subclass that configures the text view for editing.

To allow users to copy some or all of the TextView's value and paste it somewhere else, set the XML attribute android:textIsSelectable to "true" or call setTextIsSelectable(true). The textIsSelectable flag allows users to make selection gestures in the TextView, which in turn triggers the system's built-in copy/paste controls....
setTextSize Method Overview
Set the default text size to the given value, interpreted as "scaled pixel" units.
See Also
  • addTextChangedListener
    Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.
  • append
    Convenience method: Append the specified text to the TextView's display buffer, upgrading it to BufferType.EDITABLE if it was not already editable.
  • extractText
    If this TextView contains editable content, extract a portion of it based on the information in request in to outText.
  • getError
    Returns the error message that was set to be displayed with setError(CharSequence), or null if no error was set or if it the error was cleared by the widget after user input.
  • getGravity
    Returns the horizontal and vertical alignment of this TextView.
  • getLinksClickable
    Returns whether the movement method will automatically be set to LinkMovementMethod if setAutoLinkMask(int) has been set to nonzero and links are detected in setText(char[], int, int).
  • getText
    Return the text the TextView is displaying.
  • getTextColors
    Gets the text colors for the different states (normal, selected, focused) of the TextView.
  • length
    Returns the length, in characters, of the text managed by this TextView
  • onCommitCompletion
    Called by the framework in response to a text completion from the current input method, provided by it calling InputConnection.commitCompletion().
  • onCommitCorrection
    Called by the framework in response to a text auto-correction (such as fixing a typo using a a dictionnary) from the current input method, provided by it calling commitCorrection(CorrectionInfo) InputConnection.commitCorrection()}.
  • onTouchEvent
    Implement this method to handle touch screen motion events.
  • removeTextChangedListener
    Removes the specified TextWatcher from the list of those whose methods are called whenever this TextView's text changes.
  • setCompoundDrawables
    Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text.
  • setEllipsize
    Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle.
  • setError
    Sets the right-hand compound drawable of the TextView to the "error" icon and sets an error message that will be displayed in a popup when the TextView has focus.
  • setFilters
    Sets the list of input filters that will be used if the buffer is Editable.
  • setGravity
    Sets the horizontal alignment of the text and the vertical gravity that will be used when there is extra space in the TextView beyond what is required for the text itself.
  • setHeight
    Makes the TextView exactly this many pixels tall.
  • setHint
    Sets the text to be displayed when the text of the TextView is empty.
  • setImeOptions
    Change the editor type integer associated with the text view, which will be reported to an IME with imeOptions when it has focus.
  • setInputType
    Set the type of the content with a constant as defined for inputType.
  • setLines
    Makes the TextView exactly this many lines tall.
  • setMaxHeight
    Makes the TextView at most this many pixels tall.
  • setMaxLines
    Makes the TextView at most this many lines tall.
  • setMaxWidth
    Makes the TextView at most this many pixels wide
  • setMinLines
    Makes the TextView at least this many lines tall.
  • setMinWidth
    Makes the TextView at least this many pixels wide
  • setMovementMethod
    Sets the movement method (arrow key handler) to be used for this TextView.
  • setPaintFlags
    Sets flags on the Paint being used to display the text and reflows the text if they are different from the old flags.
  • setRawInputType
    Directly change the content type integer of the text view, without modifying any other state.
  • setShadowLayer
    Gives the text a shadow of the specified radius and color, the specified distance from its normal position.
  • setSingleLine
    Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input.
  • setTextAppearance
    Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
  • setTypeface
    Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.
  • setWidth
    Makes the TextView exactly this many pixels wide.