Making TextView scrollable on Android

0 votes

The text I'm showing in a TextView seems to be too long to fit on one screen. My TextView needs to be scrollable. How can I go about doing that?

This is the key:

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);

3 days ago in Android by Ashwini
• 2,760 points
7 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Android

0 votes
1 answer

How to turn on front flash light programmatically in Android?

For this problem you should: Check whether the ...READ MORE

answered Nov 8 in Android by Edureka
• 10,880 points
30 views
0 votes
0 answers

Termux code to install git on termux in Android mobile

$ pkg install github Says: Reading state information... Done E: ...READ MORE

Nov 8 in Android by Edureka
• 12,290 points
66 views
0 votes
0 answers

How to keep marker on road? Google Maps Android

I'm working on an app that displays ...READ MORE

Nov 9 in Android by Edureka
• 10,880 points
19 views
0 votes
0 answers

In which language is basically written Chrome Browser on Android?

What language is the Android version of ...READ MORE

Nov 10 in Android by Edureka
• 12,290 points
21 views
0 votes
1 answer

Why YouTube Player API does not work on Android 11?

The Android 11 package visibility limitations prevent ...READ MORE

answered Nov 15 in Android by Edureka
• 12,290 points
33 views
0 votes
1 answer
0 votes
1 answer

Kotlin Convert Bitcoin value into Satoshi Value

java.lang.NumberFormatException: For input string: "45,586" This means ...READ MORE

answered Apr 12 in Blockchain by Soham
• 9,670 points
102 views
0 votes
1 answer

How to write the Bitcoin logo as text?

Create a string in strings.xml like the ...READ MORE

answered Apr 12 in Blockchain by Aditya
• 7,660 points
144 views
0 votes
1 answer

Android - Set text to TextView

After discovering the views, you set the ...READ MORE

answered Nov 10 in Android by Edureka
• 10,880 points
36 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP