Prevent EditTexts from Getting Focus When ScrollView Is Scrolled...

sconcequence

Member
Licensed User
Longtime User
This was mentioned on these forums before, but from a different perspective.

Whenever I scroll my ScrollView down, the EditText nearest to the top of the screen gets focus. I simply need to ensure that this focus shift never happens or is diverted.

Under the _FocusChanged Sub for the EditTexts, I put in:

B4X:
If HasFocus = True Then
      If usOddsText.Text = "" Then
         dummyEdit.Visible = True
         dummyEdit.RequestFocus
         p.HideKeyboard(Activity)
         dummyEdit.Visible = False
      End If
End If

Which isn't a perfect solution because it doesn't distinguish between actual focus changed based on clicking and the "auto focus" caused by the ScrollView, but this code does nothing anyway.

Where do I put this focus diversion code so that the EditTexts lose their focus when the ScrollView gives them focus?

Thanks.


--
 

rbw152

Member
Licensed User
Longtime User
I get the same issue. I want to get focus if I click inside the edittext, but leave them alone when simply scrolling the scrollview. All controls (including the edittexts) are dynamically generated inside the scrollview. Any news on this?
 
Upvote 0
Top