question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextView with ScrollView: If TextView is set to read-only TAB and ENTER keys are eaten

See original GitHub issue

This can be reproduced in the Wizard Scenario by setting helpTextView.CanFocus = false in WizardStep().

Not sure if this is a bug in TextView or ScrollView, or if there is a different way of enabling scrolling on TextView that works around this.

What I want is a read-only TextView that

a) Doesn’t take focus b) Can be scrolled with either mouse or keyboard

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
tigcommented, Jun 13, 2022

Here’s the big idea:

A read-only TextView with a ScrollBarView is useful for displaying long text. When it is read only the user should be able to tab into and out of it. There is no world where it should eat tab presses when it is focused (and read-only).

Right now when ReadOnly == true the developer has to explicitly set AllowTabs = false for the control to work as expected.

The workaround is to set AllowTabs = false.

I assert this is a bug, and if ReadOnly == true the control should ACT as though AllowTabs == false. I do NOT think the fix is to automatically set AllowTabs when ReadOnly changes.

1reaction
tigcommented, Jun 13, 2022

CanFocus equal to false doesn’t allow to be focused. If you want use the scroll bar set the ReadOnly = false.

This is what I have done. helpTextView.ReadOnly = true. The problem is, when you tab into the helpTextView you can’t tab out.

But… I just discovered setting helpTextView.AllowTab = false addresses the issue.

In other words, the REAL bug here is when TextView.ReadOnly == true the view should IGNORE tabs (as though AllowTab = true).

Note that when AllowReturn is set to false, something else is goofy, but that’s another bug which I’ll file a separate issue on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trying to display scrollable text in a fixed-sized container
I've tried using a read-only, multi-line EditText instead of the TextView and removing the ScrollView, but I couldn't make the EditText ...
Read more >
TextView | Android Developers
android :digits, If set, specifies that this TextView has a numeric input method and ... focus instead of inserting a newline when you...
Read more >
How to Make TextView Scrollable in Android?
Follow the below steps once the IDE is ready. TextView Can Be Made Scrollable by Two Methods: 1. By using ScrollView: With the...
Read more >
ScrollView in Android
Defines which scrollbars should be displayed on scrolling or not. From ViewGroup. Attributes. Description. android:addStatesFromChildren, Sets ...
Read more >
Swiftui get size of text. Apple does provide a custom font ...
import SwiftUI struct ContentView: View { var body: some View { GeometryReader {geometry in VStack { Text("Sizes") . blue with TextView in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found