I have a scrollview that extends beyond the visible screen, but I would like to keep a bar affixed to the bottom of the screen. How do I do so while still allowing the user to scroll beyond the visible screen?
you can make a LinearLayout vertical mode, put a scrollview first, then another layout that is your bar, it will be below the scrollview
Related
I need to add a Button that is attached to the bottom of the screen so that it remain in that place when scrolling (other widgets move, but this don't). How to do it?
Put everything that you want to scroll in scrollview.
You want that button at the bottom of the layout. Set android:layout_alignParentBottom="true" in the xml of the button.
In my app I have a scroll view with n number of data to be listed out. There are two buttons one is named as UP placed above scroll view and the other is DOWN placed below scroll view.
Using the UP and DOWN buttons the list of views can be scrolled.
When the scroll bar is in top the Up button will be invisible and when the scroll bar reaches the bottom the DOWN button will become invisible, I have written logic for this using the getScrollX() method.
Now my problem is when there is very few data for example 3, the scroll bar will not be visible and the layout cannot be scrolled, in such a case both the UP and DOWN buttons need to be in invisible. How to do this, please suggest me a way?
You can try and use a ViewTreeObserver to check the dimension of the View inside your ScrollView. If the dimension exceeds a certain limit (such as the screen size), the ScrollView will be scrollable. See this preview SO answer for more details. Hope that helps!
I have a ScrollView that I am trying to use to replicate the accepted behavior of a text messaging app. When the ScrollView is first loaded, I scroll to the bottom. And when the soft keyboard is brought up, the ScrollView adjusts its height to compensate. But when the height of the ScrollView is reduced, the bottom contents are hidden, instead of the top contents. I would like for the contents to be pushed up as the size is reduced.
Now I could scroll to the bottom as soon as the ScrollView is re-sized, but what if the ScrollView is not already scrolled to the bottom? Essentially, I want to keep the last visible text message that the user is looking at visible, regardless if it is at the bottom of the ScrollView or not.
I've also tried using the ADJUST_PAN layout parameter, but I don't want my whole window panned up. But if there is an analogous ScrollView behavior, that is exactly what I'm looking for.
I have a ScrollView layout like this, for example:
<ScrollView>
<Component1>
<Component2>
<Component3>
<Component4>
...
</ScrollView>
Inside ScrollView I have some components, each of them can be anything like LinearLayout, RelativeLayout, TableRow, ...
Now what I want is I will scroll the view, when the <Component2> reach the top of the screen, it will be keep on the screen and <Component3>, <Component4>... will keep scrolling till the end of page. When I scroll down, <Component2> will only be scrolled when all the <Component3> has became visible. I saw this on an Iphone app and wondered how to achieve this on Android.
I don't know if I describe clearly enough but it is same like this video
http://www.youtube.com/watch?v=jXCrM1rzLZY&feature=player_detailpage#t=71s
When the tabs scrolled up to top, it stay there. And when scrolled down like in 1:36 of that video, it stay there until all the content below has became visible on the screen.
Does anybody know how to do this on Android?
I guess you could create a hidden copy of Component2 in a RelativeLayout that is setVisible(true) when the coordinates of Component2 are lower(Android draws from the top) than the top of the ScrollView. When the coordinates of Component2 are higher than the top of the ScrollView (.getTop()), Component2Copy.setVisible(false).
You may also want to disable them when changing their visibility. Good luck with this.
I was wondering how to create a navigation bar
like the one at the top of the screen that moves when "flicked" or scrolled.
Use a HorizontalScrollView, wrapped around a LinearLayout of Buttons or ImageButtons.