Android Scrollview gets overlapped by a view and keyboard - java

I have searched the web for about 2 hours and no solution, now I will try it here.
My problem is that when I open the keyboard the scrollview gets overlapped by a view and the keyboard. I want to see the bottom elements of the scrollview.
Here are the screenshots: screenshot1, screenshot2.

The scrollview doesn't respond to adjustReize like other views do, the solution (like other people have done e.g. Why doesn't android:windowSoftInputMode="stateVisible|adjustResize" adjust the screen when soft keyboard is shown?) will simply listen to the view's hierarchy and scroll to the bottom when the keyboard is shown

Related

How to make dimming effect of Youtube when motionLayout transitions from start to end?

I'm trying to make this effect but has no idea, how to achieve it:
My idea is to have a Frame Layout which wraps the video fragment, and the Video fragment has motion Layout as its root layout. So, Frame Layout is in main Activity, but motion Layout is inside a .xml file, which will soon be inflated as the Video fragment's layout. It looks something like this (The frag container will match parent in its width and height):
My questions are:
Is this a good idea to make this transition?
How to make the dimming effects that YouTube has? I'm planning to use this Listener for tracking the transition but has no idea how to make the slowly dimming effect :(. MotionLayout.TransitionListener
Any idea?
One way I can think of cover the screen with a a View that is
#000000 and transition the views color to #FF000000 using a custom Attribute.
The View would need to be gone, Invisible, or translationZ = -1 at the start

How to resize image as I scroll?

I have a ScrollView in which I have inserted a ConstraintLayout that contains a fullscreen ImageView and some other components below it.
What I want is for the image to shrink in height (to a certain limit) whenever I scroll down.
Here's an example of what I'm seeking: https://imgur.com/rlOr0HA
As for resizing, after some research I figured I'd have to create a LayoutParams object and then affect it to the ImageView. No problem there.
But as for detecting the scroll event, I've had some trouble. I tried the setOnScrollChangeListener on my ScrollView, but the problem is that it requires an API level of at least 23. So I wonder if there is another solution that works for lower levels as well.
Another problem I'm having is how to make the resizing proportionate to how much the user has scrolled.
You are looking to do the coordinator layout with a collapsing toolbar. This is built into android and you do not need any code changes. The inflater will inflate the layout and everything will work.
In your xml layout file you will need
<coordinatorlayout
<Appbar layout
<collapsingtoolbar
<ImageView> <-- your image goes here
/collapsingtoolbar
/Appbar layout
/coordinatorlayout
<nestedscrollview
<textview> <--Your content that moves up goes here
/nestedscrollview
<floating action button> <-- your example shows one of these buttons but its optional

Prevent Keyboard layout hiding toolbar but reveal scroll content

Best description for my issue was at
Keyboard layout hiding android action bar?
And I will paste-quote here:
"I have this problem also but the difference is, i have a list above my edittext and can't use a scrolling container. If I use adjustResize when the edittext is focused it appears above the list and the last items from the list get obscured (list is not pushed up). If I don't use adjustResize on the other hand, when the edittext is focused it pushes everything up but the acionbar is hidden and also I cannot scroll to the top of the list. Can someone share a solution for this? "
So
I have a toolbar
then a chat content
and then a bottom bar for sending a message (editText and a button)
Now, when I tap on an ediText, and soft keyb opens up, I do NOT want my toolbar to collapse and hide, but I do want my chat content to scroll up, so above the bottom entry I will see the last messages from chat content (in listView).
I've tried a number of combinations for Activity adjustResize or adjustPan, but none of them was working. Even wrapped toolbar in CoordinatorLayout and AppBarLayout, but still, no results. Either my content gets pushed/scrolled correctly but toolbar hides OR toolbar stays but softKeyboard overlaps last couple of messages.
The solution I share is a workaround. I had implemented a function scroll(), to scroll my content if a new message arrives, so that was one function I implemented before. I was missing the other part and that is, detect when a softKeyboard was open so I can scroll my content.
That was easy to find here on
How to check visibility of software keyboard in Android?
I hope someone will find this workaround useful and sleep at least a couple more hours.
Note:
Animation of sliding content up is not consistent with softKeyboard sliding up. After keyboard is opened, then I do scroll, which is not in-sync. It is just a snap. But I don't care about that until I find a better solution for orchestrating this event using a native Android component or layout.
The easiest and best solution to all of the above is to simply use the following:
listView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);

How to get informed about scrolling over the top of a ScrollView

Can somebody help me? I have an activity with a ViewPager in it. The Pages (Fragments) uses vertical ScrollViews. How can i realize, that a user who wants to update its contents can do it like in other apps e.g. Facebook? I mean, if the user is on the top of a ScrollView and he try to scroll up again, then there should open a loading-animation on the top of the ScrollView and a function loads data from a web sever....
So how i can get notified about the scroll up gesture of the user ?
I know that i will need a "invisible" view above the scrollView wich became visible when the user scroll "over the top" of the scrollView. The Animation and the dataexchange with the web server still aren't a problem - i will do it in an async task. My only question: where i have to listen on, to get informed about the scroll gesture over the top of the ScrollView?
Thanks,
Greets
PS: Sorry for my english - i am not a native english speaker.
Use OnScrollViewListener her is example for how to use it

Soft keyboard hides EditText

Already tried setting android:windowSoftInputMode="adjustPan" in the manifest file,
When I tap the bottom (4th one from top) EditText, the soft keyboard partially hides it:
This however does not happen in the Android emulator - the screen pans and I get the focus on the EditText (keyboard still covers a small part of the EditText but it's acceptable I think):
Put your EditText inside the ScrollView and then give property adjustResize, instead of adjustPan, it will automatically adjust your screen and its components.

Categories