I have a recycler view and the rows in each recycler view can have varying size depending on information inside them which is dynamically filled into it.
Now when I scroll the recycler view the layout gets inflated and there is a sudden jerk in the screen. So i want to animate this part where i can just expand the lower bound of the row or any other method suitable.
How do i animate just the lower bound?? please help..
i have used this code
int height = holder.customLayout.getHeight();
holder.customLayout.animate().translationY(height).setDuration(1000);
but it messes up with entire view
Related
I've been having some trouble enabling fast scrolling for a Grid View and a List View. I've set fastScrollingEnabled="true" in their XML layouts and added both the horizontal and vertical state drawables for the track and thumb. I also added these values to their styles, as well, and have "[GridView | ListView].setFastScrollEnabled(true) set programmatically. However, when I run the application, fast scrolling does not work. After some investigation, I've noticed via Layout Inspector that the fastScrollEnabled attribute is set to "false" for both the Grid View and the List View. Why would Android automatically set this value back to false? Is there a way for me to prevent this so that I can fast scroll on these view types? I've gotten fast scrolling working on Recycler Views in the same application with the same amount of setup, but for some reason the Grid View and List View fast scrolling attribute remains false.
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
Is there any library or any way in which we can sync between the RecyclerView and the Seekbar.
By that I mean is that when I drag seekbar the items change, the seekbar width define the maximum scroll that the recycler can have. Similarly when I scroll the recyclerview the seekbar should update.
In short both should be in sync.
Or is there any other way to handle it.
What I am trying to achieve can be seen from the image attached to this question. Here top section is the seekbar and the bottom section is recyclerview.
Any solution or help is appreciated.
First of all, you can listen to the change of seek bar value by the setOnSeekBarChangeListener(). See get android seek bar value and display it on screen
.
Then, when seek bar value is changed, you can notify the recycler view to scroll to any position by the smoothScrollToPosition() of recycler view or smoothScrollToPosition() of linear layout manager
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.
How do I figure out what the height and width of my ListView item cell is? After I inflate it, getHeight() and getWidth() both return 0.
When I inflate my cell layout xml in my list adapter's getView(), the height and width of the view is still (0,0). I'm assuming the size of the cell and its subviews won't be set until after I return the cell and it gets automatically added to the ListView. So, how/when/where can I get the real size information for my view and its children?
Each row in my ListView has 4 TextViews which form columns in the ListView. I need to dynamically determine the best fittable font size so that all of the numbers in my TextViews will fit. In other words, if I need to use a textSize of 16 in order to fit the largest string into it's TextView, then I want all 4 TextViews in every row to use textSize=16.
I'm preprocessing all of my data to find the longest strings, I just need to find out how big each of my TextViews are in the ListView rows... but when I'm inflating them in getView(), the row and the children in the row have height/width of (0,0).
How do I figure out what the height and width of my ListView item cell is so I can determine the right font size?
Inflate a layout doing not immediately. This process need a some time. Inflate task stored in internal queue and need time to push out from internal queue.
Try to use a TextView.post method. Then you can get real View size asynchronously, some time later. The Runnable implementation will be run in UI thread.