Best code examples for Android TextView class (android.widget.TextView)

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

Android TextView examples from Open Source projects
This code example shows how to use the following methods: setFocusable, setFocusableInTouchMode, setLayoutParams, setOnKeyListener, getImeOptions
67:	textView.setOnKeyListener(this); 
-
70:	textView.setLayoutParams(textBoxLayoutParams); 
71:	textView.setFocusable(true); 
72:	textView.setFocusableInTouchMode(true); 
73:	textView.setImeOptions(textView.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI); 
Full Snippet Info
9
CodeRank
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: getScrollX, getScrollY, getLayout, getTotalPaddingLeft, getTotalPaddingTop
38:	x -= widget.getTotalPaddingLeft(); 
39:	y -= widget.getTotalPaddingTop(); 
-
41:	x += widget.getScrollX(); 
42:	y += widget.getScrollY(); 
-
44:	Layout layout = widget.getLayout(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
116:	mTitleView.setText(title); 
-
118:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setGravity, setText
122:	TextView tv = new TextView(getActivity()); 
123:	tv.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, 
-
125:	tv.setText("Fragment #" + mNum); 
126:	tv.setGravity(CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText
80:	TextView txt=new TextView(this); 
-
90:	txt.setText(String.valueOf(runtime)+" seconds since activity launched"); 
-
93:	getListView().postDelayed(new Runnable() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setId, setVisibility, setGravity, setPadding, setText
95:	mStandardEmptyView = new TextView(context); 
96:	mStandardEmptyView.setId(INTERNAL_EMPTY_ID); 
97:	mStandardEmptyView.setGravity(Gravity.CENTER); 
98:	mStandardEmptyView.setVisibility(View.GONE); 
99:	mStandardEmptyView.setPadding(10, 15, 10, 15); 
100:	mStandardEmptyView.setText("That's all, folks!"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setTag, setVisibility, setText
109:	view.setText(html); 
-
113:	view.setVisibility(VISIBLE); 
114:	view.setTag(null); 
-
119:	view.setText(null); 
120:	view.setVisibility(GONE); 
121:	view.setTag(null); 
-
180:	view.setTag(id); 
Full Snippet Info
8
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: setLayoutParams, setGravity, setText
136:	TextView tv = new TextView(getActivity()); 
137:	tv.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)); 
138:	tv.setText("Fragment #" + mNum); 
139:	tv.setGravity(CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setGravity, setPadding, setText
116:	TextView textView = new TextView(ExpandableList1.this); 
117:	textView.setLayoutParams(lp); 
-
119:	textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); 
-
121:	textView.setPadding(36, 0, 0, 0); 
-
128:	textView.setText(getChild(groupPosition, childPosition).toString()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setVisibility, setText
427:	v.setText(text); 
-
430:	v.setVisibility(View.GONE); 
-
432:	v.setVisibility(View.VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setCompoundDrawablesWithIntrinsicBounds, setGravity, setPadding, setText
142:	TextView textView = new TextView(ActivityPickerActivity.this); 
143:	textView.setLayoutParams(lpGroup); 
144:	textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); 
145:	textView.setPadding(leftPadding, 0, 0, 0); 
-
172:	textView.setText(info.applicationInfo.loadLabel(mPackageManager)); 
173:	textView.setCompoundDrawablesWithIntrinsicBounds(Utilities.createIconThumbnail(info.applicationInfo.loadIcon(mPackageManager),ActivityPickerActivity.this), null, null, null); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText
25:	helloTextView.setText(helloMessage); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setText, setTextColor, setTextSize
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: setId, setGravity
76:	TextView tv = new TextView(getActivity()); 
77:	tv.setId(INTERNAL_EMPTY_ID); 
78:	tv.setGravity(Gravity.CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText, setTextColor
308:	subText.setText(error.message()); 
-
311:	subText.setTextColor(Color.RED); 
-
315:	subText.setTextColor(Color.rgb(255,192,0)); 
-
318:	subText.setTextColor(Color.BLUE); 
-
321:	subText.setTextColor(Color.LTGRAY); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setContentDescription, setOnClickListener, setVisibility, setText
91:	mRotateDialogButton1.setVisibility(View.GONE); 
-
124:	mRotateDialogButton1.setText(button1Text); 
125:	mRotateDialogButton1.setContentDescription(button1Text); 
126:	mRotateDialogButton1.setVisibility(View.VISIBLE); 
127:	mRotateDialogButton1.setOnClickListener(new View.OnClickListener() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getBottom, getTop, layout, setTextColor
190:	view.layout(newLeft, view.getTop(), newLeft + viewWidth, view.getBottom()); 
191:	view.setTextColor(Color.rgb( 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
112:	mTitleView.setText(title); 
-
114:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getWindowToken, getText, setText
74:	adapter.add(v.getText().toString()); 
75:	v.setText(""); 
-
80:	imm.hideSoftInputFromWindow(v.getWindowToken(), 0); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText
26:	helloTextView.setText(helloMessage); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setVisibility, setEllipsize, setSingleLine, setText, setTextAppearance
239:	mTimeTextView = new TextView(mContext); 
240:	mTimeTextView.setSingleLine(true); 
241:	mTimeTextView.setEllipsize(TruncateAt.END); 
242:	mTimeTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Small); 
-
245:	mTimeTextView.setText(text); 
246:	mTimeTextView.setVisibility(View.VISIBLE); 
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: getHeight, setGravity, setText, setTextColor, setTextSize
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: setVisibility, setEllipsize, setGravity, setSingleLine, setText
286:	mNameTextView = new TextView(mContext); 
287:	mNameTextView.setSingleLine(true); 
288:	mNameTextView.setEllipsize(TruncateAt.END); 
289:	mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Large); 
290:	mNameTextView.setGravity(Gravity.CENTER_VERTICAL); 
-
293:	mNameTextView.setText(text); 
294:	mNameTextView.setVisibility(View.VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
116:	mTitleView.setText(title); 
-
118:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getText, getTextColors, getTextSize
64:	if (tv.getText().toString().startsWith(TEXT_SEARCH_PREFIX)) { 
65:	int textColour = tv.getTextColors().getDefaultColor(); 
66:	TextAppearance appearance = new TextAppearance(textColour, tv.getTextSize()/displayMetrics.scaledDensity); 
-
68:	if (TEXT_SEARCH_TEXT.equals(tv.getText().toString())) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setText, setTextSize, setTypeface
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: setLinkTextColor, setMovementMethod, setPadding, setText, setTextColor
46:	TextView tv = new TextView(this); 
47:	tv.setTextColor(0xffffffff); 
48:	tv.setLinkTextColor(0xffa3b8fe); 
-
50:	tv.setPadding(p, p, p, p); 
51:	tv.setText(Html.fromHtml(getIntent().getStringExtra("info"))); 
52:	tv.setMovementMethod(LinkMovementMethod.getInstance()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getText, setText
29:	TextView textView = new TextView(context); 
30:	textView.setText(Html.fromHtml("<b>some</b> html text")); 
31:	assertThat(textView.getText().toString()).isEqualTo("<b>some</b> html text"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: beginBatchEdit, endBatchEdit, onTextContextMenuItem
145:	mTextView.beginBatchEdit(); 
146:	mTextView.onTextContextMenuItem(id); 
147:	mTextView.endBatchEdit(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getLinksClickable, getText, setMovementMethod, setText
34:	CharSequence content = view.getText(); 
35:	view.setText(convertNormalStringToSpannableString(content.toString())); 
36:	if (view.getLinksClickable()) { 
37:	view.setMovementMethod(LongClickableLinkMovementMethod.getInstance()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addLinks, getText, setLinkTextColor
45:	if(!TextUtils.isEmpty(notesPreview.getText())) { 
46:	notesPreview.setLinkTextColor(Color.rgb(100, 160, 255)); 
47:	Linkify.addLinks(notesPreview, Linkify.ALL); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getTypeface, setTypeface
66:	if(flags < 0 && textView.getTypeface() != null){ 
67:	flags = textView.getTypeface().getStyle(); 
-
78:	textView.setTypeface(currentFont, Typeface.MONOSPACE.BOLD); 
-
81:	textView.setTypeface(currentFont, Typeface.MONOSPACE.ITALIC); 
-
84:	textView.setTypeface(currentFont, Typeface.MONOSPACE.BOLD_ITALIC); 
-
88:	textView.setTypeface(currentFont, Typeface.MONOSPACE.NORMAL); 
-
92:	textView.setTypeface(currentFont, flags); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setOnClickListener, setTag, setText
90:	Button mButton = new Button(mContext); 
91:	mButton.setText(aText); 
92:	mButton.setTag(Integer.toString(aCallback)); 
93:	mButton.setOnClickListener(this); 
Full Snippet Info
8
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
19:	textView = new TextView(inflater.getContext()); 
20:	textView.setText("CustomFragment text view"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getTextSize, getTypeface
199:	paint.setTypeface(view.getTypeface()); 
200:	paint.setTextSize(view.getTextSize()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText
28:	TextView tv = new TextView(this); 
29:	tv.setText("Hello, Crashy Android"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setText
23:	TextView view = new TextView(this); 
24:	view.setText("MostBasicWindow"); 
25:	view.setBackgroundColor(Color.CYAN); 
Full Snippet Info
8
CodeRank
Related Android TextView Questions & Answers:
Other Android TextView Examples
10:	        super.onCreate(savedInstanceState);
11:	        setContentView(R.layout.activity_main);
12:	        TextView view =  (TextView) findViewById(R.id.TextView02);
13:	        String s="";
14:	        for (int i=0; i < 500; i++) {
-
10:	        super.onCreate(savedInstanceState);
11:	        setContentView(R.layout.activity_main);
12:	        TextView view =  (TextView) findViewById(R.id.TextView02);
13:	        String s="";
14:	        for (int i=0; i < 500; i++) {

Read More

11:	
12:	public class ShowLocationActivity extends Activity implements LocationListener {
13:	  private TextView latituteField;
14:	  private TextView longitudeField;
15:	  private LocationManager locationManager;
-
12:	public class ShowLocationActivity extends Activity implements LocationListener {
13:	  private TextView latituteField;
14:	  private TextView longitudeField;
15:	  private LocationManager locationManager;
16:	  private String provider;
-
21:	    super.onCreate(savedInstanceState);
22:	    setContentView(R.layout.main);
23:	    latituteField = (TextView) findViewById(R.id.TextView02);
24:	    longitudeField = (TextView) findViewById(R.id.TextView04);
25:	
-
22:	    setContentView(R.layout.main);
23:	    latituteField = (TextView) findViewById(R.id.TextView02);
24:	    longitudeField = (TextView) findViewById(R.id.TextView04);
25:	
26:	    // Get the location manager

Read More

1:	
2:		TextView txtMessage;
3:	
4:		// Animation
-
10:			setContentView(R.layout.activity_fadein);
11:	
12:			txtMessage = (TextView) findViewById(R.id.txtMessage);
13:	
14:			// load the animation

Read More

11:	        this.setContentView(R.layout.single_list_item_view);
12:	        
13:	        TextView txtProduct = (TextView) findViewById(R.id.product_label);
14:	        
15:	        Intent i = getIntent();
-
11:	        this.setContentView(R.layout.single_list_item_view);
12:	        
13:	        TextView txtProduct = (TextView) findViewById(R.id.product_label);
14:	        
15:	        Intent i = getIntent();

Read More

0:	TextView txtView1, txtView2;
1:	Animation animFadeIn, animFadeOut;
2:	.

Read More

3:	
4:	    private MyFirstTestActivity mFirstTestActivity;
5:	    private TextView mFirstTestText;
6:	
7:	    public MyFirstTestActivityTest() {
-
14:	        mFirstTestActivity = getActivity();
15:	        mFirstTestText =
16:	                (TextView) mFirstTestActivity
17:	                .findViewById(R.id.my_first_test_text_view);
18:	    }

Read More

12:	                mClickFunActivity
13:	                .findViewById(R.id.launch_next_activity_button);
14:	        mInfoTextView = (TextView) 
15:	                mClickFunActivity.findViewById(R.id.info_text_view);
16:	    }

Read More

2:	editText.setOnEditorActionListener(new OnEditorActionListener() {
3:	    @Override
4:	    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
5:	        boolean handled = false;
6:	        if (actionId == EditorInfo.IME_ACTION_SEND) {

Read More

See Code Examples for Android TextView Methods: