Skip to main content
added tags
Source Link
hata
  • 12.6k
  • 6
  • 50
  • 77

I am displaying text in a textviewTextView that appears to be too long to fit into one screen. I need to make my TextView scrollable. How can I do that?

Here is the code:

final TextView tv = new TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); tv.setGravity(Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL); tv.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent e) { Random r = new Random(); int i = r.nextInt(101); if (e.getAction() == e.ACTION_DOWN) { tv.setText(tips[i]); tv.setBackgroundResource(R.drawable.inner); } return true; } }); setContentView(tv); 

I am displaying text in a textview that appears to be too long to fit into one screen. I need to make my TextView scrollable. How can I do that?

Here is the code:

final TextView tv = new TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); tv.setGravity(Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL); tv.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent e) { Random r = new Random(); int i = r.nextInt(101); if (e.getAction() == e.ACTION_DOWN) { tv.setText(tips[i]); tv.setBackgroundResource(R.drawable.inner); } return true; } }); setContentView(tv); 

I am displaying text in a TextView that appears to be too long to fit into one screen. I need to make my TextView scrollable. How can I do that?

Here is the code:

final TextView tv = new TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); tv.setGravity(Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL); tv.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent e) { Random r = new Random(); int i = r.nextInt(101); if (e.getAction() == e.ACTION_DOWN) { tv.setText(tips[i]); tv.setBackgroundResource(R.drawable.inner); } return true; } }); setContentView(tv); 
Question Protected by Pratik Butani
Active reading.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Making TextView scrollable inon Android

I am displaying text in a textview that appears to be too long to fit into one screen. I need to make my TextView scrollable. How can iI do that? 

Here is the code:

final TextView tv = new TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); tv.setGravity(Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL); tv.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent e) { Random r = new Random(); int i = r.nextInt(101); if (e.getAction() == e.ACTION_DOWN) { tv.setText(tips[i]); tv.setBackgroundResource(R.drawable.inner); } return true; } }); setContentView(tv); 

Making TextView scrollable in Android

I am displaying text in a textview that appears to be too long to fit into one screen. I need to make my TextView scrollable. How can i do that? Here is the code

final TextView tv = new TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); tv.setGravity(Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL); tv.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent e) { Random r = new Random(); int i = r.nextInt(101); if (e.getAction() == e.ACTION_DOWN) { tv.setText(tips[i]); tv.setBackgroundResource(R.drawable.inner); } return true; } }); setContentView(tv); 

Making TextView scrollable on Android

I am displaying text in a textview that appears to be too long to fit into one screen. I need to make my TextView scrollable. How can I do that? 

Here is the code:

final TextView tv = new TextView(this); tv.setBackgroundResource(R.drawable.splash); tv.setTypeface(face); tv.setTextSize(18); tv.setTextColor(R.color.BROWN); tv.setGravity(Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL); tv.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent e) { Random r = new Random(); int i = r.nextInt(101); if (e.getAction() == e.ACTION_DOWN) { tv.setText(tips[i]); tv.setBackgroundResource(R.drawable.inner); } return true; } }); setContentView(tv); 
edited tags; edited title
Link
Jonik
  • 82.1k
  • 77
  • 272
  • 386

Making TextView Scrollablescrollable in Android

Improve code format.
Source Link
Ciro Santilli OurBigBook.com
  • 392.6k
  • 120
  • 1.3k
  • 1.1k
Loading
Fixed code formatting
Source Link
PatrickSteele
  • 14.7k
  • 2
  • 55
  • 54
Loading
edited tags
Link
skaffman
  • 404.6k
  • 96
  • 825
  • 775
Loading
Source Link
Loading