Android Question Scrollable EditText on ScrollView

Derek Jee

Active Member
Licensed User
Longtime User
Hi there

I thought I'd asked this question before but cannot find it. Old age creeping up on me..

Have a ScrollView with a panel on it. On that panel I have an EditText which I want to be of fixed size but it will more than likely have more text in it than it will show. I would like to be able to scroll through the text or step through it and have looked at the LongText example. Unfortunately that does not seem to work on my app as I have to have it on a ScrollView.. can any one advise how I can get what I want or suggest a different solution. My current code trying the LongText approach is below..

Kind regards,

Derek.

B4X:
    SV1.Initialize(1000)


    pnl.AddView(SV1, 1%x, 51%y , 95.5%x, 12%y)
    aiedit.Initialize("aiedit")
    SV1.Panel.AddView(aiedit, 1%x, 1%y , 95.5%x, 40%y)
    aiedit.Text = ""
    aiedit.TextSize = 1%y
    aiedit.TextColor = Colors.DarkGray
    aiedit.color = Colors.LightGray
    aiedit.Gravity = Gravity.NO_GRAVITY
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This line is incorrect:
B4X:
SV1.Initialize(1000)
It should be 1000dip.

You shouldn't put a scrollable view inside another scrollable view.

If the text is not very long then you can change the EditText height based on the text and then it will not be scrollable. You can use StringUtils.MeasureMultilineText to find the correct height.
 
Upvote 0

Derek Jee

Active Member
Licensed User
Longtime User
Hi Erel

Thank you, I thought as much that 2 ScrollViews will have issues. But my problem is that I only have a fixed size EditText box as there are controls before and after. And I need the user to be able to see and scroll through the text before any save/update action is made. If there is no other solution then I guess I need to have a pop up appear with a large EditText for the user to type into and then 'save' it back into the EditText on the panel.. Does this make sense?
 
Upvote 0
Top