In my activity I have a scroll view which contains a linear layout that has many views. Is there a way I can display a specific view (from the linear layout) when starting this activity? By default this view is hidden, so I must scroll the scroll view to make it visible.
Scroll the view to the view you want to show:
scrollView.smoothScrollTo(0, specificView.getTop())
See Is there a way to programmatically scroll a scroll view to a specific edit text?
You can use:
setVisibility(View.GONE);
see setVisibility for details
Related
i have a fragment which has a stationary Image View at the top , some linear layouts to display the texts and List View at the Bottom. i want the entire screen to go up(that stationary Image View and middle part) when i scroll down in the List View.
I tried to place all layouts in a single Linear Layout and put it inside Scroll View since it has only one direct child..but that makes only the List view scroll able.
Try using CoordinatorLayout and scrolling behaviour from the design library.You can find a great tutorial here
I have Two children on a FrameLayout, a view pager and a backround view
I add the background view as a second child , so it's supposed to be on top of my view pager.
The problem is I can still scroll my view pager despite of having another view on top of it.
the structure is :
<FrameLayout>
<DrawerLayout>contains view pager and content</DrawerLayout>
<LinearLayout></LinearLayout> -> this is where I add my view as a black background
</FrameLayout>
How do I disable the input and listener for the first child of the framelayout or is there an easier way of doing this?
Tried setting the elevation, and bringViewToFront(), but those aren't working.
Thanks
You can disable focus on framelayout and enable focus on child views. See if this helps you.
framelayout.setFocusable(false);
framelayout.setFocusableInTouchMode(false);
Set focusable to true for drawerlayout and linearlayout. Hope this helps.
I think I have found the answer.
Been lurking on stack overflow a bit and found the answer on this
Overlaying a view does not disable actions on underlying view
It is stated by nizammoidu that an underlying view (behind view) will instead intercept the touch event if the front view is not consuming the touch event.
So the solution is by giving the top view (in my case LinearLayout)
clickable parameter to true
android:clickable:true
or
view.setClickable(true);
I'm using horizontal scroll view in my app. I have right arrow icon in the right corner of the scrollview. I need to make that arrow visible only when the scroll view has more childs to scroll.
Suppose if the scroll view has only one child and it doesn't need to scroll, i need to disable the arrow.
Please help me in this.
If current position is the last position in your view just invisible the arrow view
I try to implement following behavior of my app:
I've got list of views and show them in scrollview partly.
If user scroll and reaches bottom of scrollview, I add one more view below last view;
If user scroll up and reaches top of scrollview, I add view above the first view.
My problem is that when I add view above the first view it shift all views in layout down.
My question is: how to add view above view in hidden area, so user could have a look by scrolling up?
I want to add footer view to GridView in android as we can add to ListView. Since it is not available in Grid View, I added a loading layout at bottom of screen, and a grid view above it. Loading layout becomes visible when we scroll grid view till end. But when loading layout becomes visible, on scrolling upwards, it remains visible. How this can be customized in a way similar to footer of list view. Any help will be highy appreciated.
Grid View doesnot have footer similar to listview. Its workaround used was: Add a view having progress dialog at bottom of screen below gridview and manage its visibility.