I have implemented an Eclipse view. The problem is that when the content is taller than the view height the bottom is depicted and you always have to scroll it up. I'd like to change it programmatically and have the scroll bar positioned at the top.
Is there any way to do that?
Related
Now I want to create layout like this in my MainActivity
and I want to set up my scroll view. When I scrolling Content view move to top of Main view like this
It move to Top of main view and expand content view follow my scroll view
and when it expanded reach the specified point I want to make it like this
set the top layout of content view (Red color) to fix not moving and go to scroll only main content layout (Blue Green Orange color)
and then finish of scrolling when i scroll down it all of layout return to first picture
Anyone can help recommend me.
I have been stuck in this problem for many days.
Java, Android Studio
I'm sorry for my English I'm not good at English
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
How could this scrolling behavior be accomplished?
Screenshot
To be specific, I need the wave effect to be shown whenever I try to scroll and reach the limit of a layout. Is there some property that I can tweak?
To get this wave effect, use any horizontally or vertically scrollable view as a container layout in your layout XML.
For example: ScrollView, HorizontalScrollView, NestedScrollView
List and Grid layouts like ListView, RecyclerView also has this scrolling effect.
I am using custom list view with base adapter. The width of row is longer than screen. But I am not getting horizontal scroll bar like automatic vertical scrollbar. Do I need to specify any extra attribute? I tried with putting listview in horizontal scroll view but still no success. How should I achieve this?
Thanx in advance.
You might just need to use android:layout_width="wrap_content" in your horizontal scroll. You should also show your XML layout in case it is just some other minor change, like having the list view inside the horizontal scroll view.
As a side note, you won't get a horizontal scroll bar but the views inside the horizontal scroll view will slide left/right if their width is wider than the screen.
I have a text view on my android app which I want to place in a specific place on the screen. This is because there is a background on the screen and the text view has to show in line with the space I have made for it in the background.
I'm moving the text around using the margins and entering for example 20dp for top margin 10dp for right margin.
Is there any other method I can use in order to ensure that the text view will be displayed in the right place on all devices? As other dvices mas have a higher or lower res.
use relativelayout and you can control the position of a view in a much better way.
android:layoutalign_parentright=true tag makes the view to be the right always.
android:align_right="#id/someViewId" makes the right edge of this view aligned with the right edge of someViewId view.
It packs a lot of tags that enables you to do such stuff.