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

Nov 23, 2022 in Android by Ashwini
• 5,430 points
510 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
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, 2022 in Android by Edureka
• 12,690 points
1,655 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, 2022 in Android by Edureka
• 13,620 points
2,092 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, 2022 in Android by Edureka
• 12,690 points
382 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, 2022 in Android by Edureka
• 13,620 points
992 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, 2022 in Android by Edureka
• 13,620 points
2,103 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, 2022 in Blockchain by Soham
• 9,710 points
838 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, 2022 in Blockchain by Aditya
• 7,680 points
953 views
0 votes
1 answer

Android - Set text to TextView

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

answered Nov 10, 2022 in Android by Edureka
• 12,690 points
2,700 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