I have a 'page' that has a number of components on it, and who's content is longer than the height of the device. one of the component is view pager. Content of view pager is also very large. How can i combine vertical scroll view of parent layout and view pager layout.My laytout is as follows:
few components
view pager-(large content in another layout)
few more component
i want to combine scroll view of view pager and parent layout
It should just work. See here -> ViewPager inside a ScrollView does not scroll correclty
You structure should be like this:
ScrollView
-ViewPager
--ScrollView
Then just apply the suggestions made in the linked post above.
Also make sure the ViewPager has a fixed height! Otherwise the ScrollView inside the ViewPager won't work without writing a custom ScrollView or ViewPager.
Related
I want to know if it's possible to programmatically add a view to the texture view (camera2).
If I add the texture view to a frame layout which has a view in it, then that view is not visible.
Good day. I have activity with viewpager 2 (horizontal direction) and fragment which used by this viewpager. This fragment contains collpasing toolbar and nested scroll view with scrolling content. When i triyng to scroll content of my fragment from bottom to top and when, i'am scrolling up, the finger moves a little to the side - the scrolling is interrupted and the horizontal scroll of the view pager is triggered. How i can disable horizontal-scroll of the view pager while i'am scrolling vertical nested scroll view?
I have custom view with extends LinearLayout. Custom view is viewpager with grid view inside. I add "wrap_content" wherever possible, but my view spend whole screen or only one grid's view line.
I find examples GridView with wrap_content function, but it is not help me
I intend achieving a layout similar to what is shown.
I have tried achieving similar behavior with Bottom sheet, percentFrameLayout, ScrollView and Coordinated layout on different occasions, but I've not being able to achieve something similar to the view that (possibly a fragment) that is scroll from the bottom of the screen and interact with other child views on the screen like the tab and the refresh button.
Any guideline and directions on how i can do this ?
You can use a RecyclerView for the cards and leave your toolbar and main content on a FrameLayout at the same level as the map. And of course a coordinator layout and proper behaviors on each element.
By doing this your recycler view will be able to interact with the toolbar and still be independent from the map.
In other words, you can reduce your problem to a single recyclerview scroll with a toolbar by making a space on the beginning of the vertical recyclerView.
I'm trying to add a scroll view inside another scroll view.
It should look like is this:
scroll view
linear layout
myprogramaticscroll view
myprogramticlinear layout
myprogramticbutton
end button
end layout
end scroll
end linear
end scroll
I'm trying to add scroll views inside of that. It goes in there, but I need to know how to set parameters correctly so I can see the whole button I have inside of my scroll view. I only see part of it, and I need to set the programatic linear layout and scroll view's width height and id. How do I do this? This is what I have so far:
//the layout I'm putting my scrollview/linearlayout/button in
LinearLayout l = (LinearLayout) findViewById(R.id.linearLayoutFavorites);
ScrollView scroll = new ScrollView(this);
LinearLayout nl = new LinearLayout(this);
ImageButton yourButton = new ImageButton(this);
nl.addView(yourButton);
scroll.addView(nl);
l.addView(scroll);
You CAN'T put a scroll view inside another scroll view, that behavior would be odd, and Android would not know how to handle your scroll on the views.
For setting layout parameters, take a look at ViewGroup.LayoutParams, there're actually quite a few subclasses of ViewGroup.LayoutParams, which are for setting layout parameters for different kinds of layouts.
You can use a Scrollview in an another Scrollview. But this is not suggestible. It will be an issue to both the user and android OS. It will leads to Memory issues and also touch issues while scrolling the views. If you are expecting the Two scrolls (Horizontal and Vertical) at a time, then it is preferble to go for TwoDSCrollView
If you want to set the Layoutparams you should look at ViewGroup.LayoutParams.
If you want to set width and height then no need to set the Layoutparams. You can get the existing params by using getLayoutParams() for the view and set width and height to that params.
If you want to place vertical in vertical scroll or horizontal in horizontal scrollview the you should set the height of the internal scrollview height to the actual height of the total childs.