Android - Soft touch pad hides ListView items - android

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.

Related

Focus Trapped Inside TextView With LinkMovementMethod When Navigating With Arrow Keys

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?

EditText in RecyclerView view is detached when keyboard opened

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)

EditText inside ListView loses focus on keyboard show

EditText inside ListView loses and gains focus 3 or 4 times when keyboard shows up. I have properly configured ListView (beforeDescendants) and Activity (adjustPan). I have over 500 items in ListView so I can't use ScrollView. I've made some research and I found that people had same problem. What keeps stealing focus during keyboard show up? Are views invalidated in that process?

EditText above listview, scroll page with keyboard

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?

Android Expandable ListView with EditText

I am currently using an ExpandableListView with a EditText as a child item. I want to give focus to the EditText when the item is expanded and automatically display the keyboard.(This turned out to be more difficult than what I expected. I can give focus to the EditText(using this post Focusable EditText inside ListView), but the keyboard is either never shown or it blinks and then hides itself).
Is a ListView the best approach to do this? Should I rather be looking at creating dynamic views inside a LinearLayout of a ScrollView?
Any suggestions/Ideas?
Sounds like some other view other than your TextView is receiving focus after your TextView receives focus. I would debug by overriding onFocus events on some Views and seeing if they get hit after your TextView.

Categories

Resources