I have a TextView with the LinkMovementMethod movement method. I have also called Linkify.addLinks(description view, Linkify.ALL) to make links clickable. The issue I am seeing is on Oreo devices (Android 8.0). When navigating the page with hardware arrow keys, when the focus shifts to the TextView, the arrow keys will scroll the content of the TextView but the focus is trapped in the view. Once the view has scrolled to the top/bottom, pressing the up/down arrow cannot get focus out the view. How can I get the EditText to give up focus when the view has fully scrolled with arrow keys?
Related
My current view consists of a scroll view, and a bottom action button area. The bottom action buttons are always visible regardless of how many fields I have inside the scroll view:
Problem is, when windowSoftInputMode is adjustResize, the bottom action button area gets pushed up and the scroll view becomes really small and only two fields are visible at a time, plus it is hard to scroll up and down to see all the other fields as the area is so small, it does have one advantage where the bottom action buttons were not blocked by the soft keyboard:
I tried changing windowSoftInputMode to adjustPan, it pans to where the input focus is, which is pretty neat, however the problem is now the bottom action buttons are blocked by the soft keyboard, no matter how much I tried to scroll down:
How to make it so that when the soft keyboard is shown, the scroll view area still remains the same, but when I scroll to the bottom of the scroll view, I am able to continue scrolling until the bottom action buttons can be accessed, without dismissing the soft keyboard?
I have an issue where on small devices, some content gets cut off when the keyboard is open. To mitigate that, we added the adjust resize soft input mode. This scrolls the view up nicely and the user can then scroll that view up and down.
However, when they click next on the keyboard, another edit text is given focus but it does not scroll the newly selected edit text to the top to be focused.
How do I make it scroll the currently focused edit text to the top of the layout?
I am attempting to create a long form with a variable number of EditText elements inside a RecyclerView. The layout consists of a FrameLayout, a RecyclerView for the form sections, then a nested RecyclerView inside of a CardView to hold all of the form elements for that section (see animation below).
Normally when an element is focused the keyboard will appear, the window is resized, and the view is scrolled so the element appears above the keyboard. The issue I am having is when an element is selected at the bottom of the screen and top of a section the window is resized and the RecyclerView detaches the section's view, causing the EditText to not exist when it tries to focus. This manifests itself as the keyboard popping open momentarily then closing as focus is returned to the FrameLayout.
I am using android:windowSoftInputMode="adjustResize" in my activity and do not want to use adjustPan because it does not provide the best user experience.
I've tried adding a click listener to the EditText then scrolling the RecyclerView up so that the view won't get destroyed when the window resizes but this feels hacky and it is hard to detect precisely how far up the RecyclerView should be scrolled. You also get some weird jumps. In order to do this you have to turn off the focusability of the EditText which isn't ideal either because it breaks navigation and accessibility.
Trying to do something like recyclerView.getRecycledViewPool().setMaxRecycledViews(0, SECTION_COUNT); doesn't work either because it doesn't prevent the views from being detached.
How do I keep the view from being detached when the window is resized for the keyboard so the EditText receives focus?
I solve this with by
android.os.Handler().postDelayed({recycle.smoothScrollToPosition(0)},100)
so i have some elements (including an EditText) above my ListView. The EditText is essentially a custom search field that I implemented to add some extra functionality to the filtering of the ListView. The EditText cannot be a header of the ListView because I don't want it to scroll off screen as you go through the list.
All works well, except on smaller devices. The screen does not scroll when you are entering text in the EditText so you can't see the live-filtering within the ListView.
Usually you would make the parent item in the layout file a ScrollView and define the activity's windowSoftInputMode as adjustResize, but this is not an option due to the fact that I have this ListView within the layout and it is a sin to have a ListView within the ScrollView.
Ideally, I'm looking for a way to make the following happen:
-upon the EditText gaining focus, I'd like it to scroll to the top of the page, and the listview occupy the rest of the screen.
-upon the EditText losing focus I'd like the screen to return to it's default state.
so far, the only real way that I'm coming up with doing this is to manually detect the keyboard showing up and then hide the top of the screen, and then upon detecting the keyboard disappearing i would show it again.
can anyone suggest something better that isn't such a hack?
I have a ListView wich contains EditText views. When touching these EditText views, the soft key pad comes up (as desired).
When using android:windowSoftInputMode="adjustPan" the touch pad hides the bottom part of the ListView and thus possibly the EditText view in focus (just touched). I know that this can be solved by using android:windowSoftInputMode="adjustResize">. However, in this case due to resizing the EditText view loses focus.
I am now wondering whether it would be possible to both have the key pad not hide the EditText view and also have it not lose focus.