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
Related
I want to make a horizontal scrollview that clips to the closest scroll object, for example, if I have scroll objects 1,2,3 in the scrollview and the user stops scrolling between 1 and 2, the scrollview should jump to the closest object, is this possible in android?
You can do it with RecyclerView and SnapHelper.
Some good sample for it:
1- Using SnapHelper in RecyclerView
2- Detecting snap changes with Android’s RecyclerView SnapHelper
How can I make a working bottom navigation bar with ImageViews in a LinearLayout(Horizontal) With fragments ? instead of menu items.
if already exist then please share the source code. Please help quickly :)
Or the Question could be this :
https://github.com/qhutch/BottomSheetLayout/issues/12#issue-576279364
Oh, I found my solution not exactly but this is what I want...
I add that Bottom Navigation View in a LinearLayout(horizontal) and I delete all default Styles from BottomNavigationView. So now this is not looking like a card view. After this, I add an ImageView in the LinearLayout with a weight of a ratio of 1:3 (for 4 icons ). Now I can use effects and designs on my LinearLayout. And it is looking like how I wish. đŸ˜Œ
[Note: For horizontally rotated screen LinearLayout, ImageView, BottomNavigationView 's width:match-parent]
I have implemented the recycler view in navigation drawer in android.This is working fine.I am able to switch between item by clicking on recycler view item.
but i am not able to change the background color for the selected item.please suggest me how to imeplement it.I have tried this so far.
1.Background Selector in RecyclerView Item
Tried to make recycler view clickable,focusable but didn't work
2.http://innodroid.com/blog/post/tracking-selected-item-in-recyclerview
implemented but didn't understand where to write the code for changing background
Please help me out.
What you really need to understand with RecyclerView is that it's not the same control as a Listview with a funky adapter.
RecyclerView does not exhibit many of the ListView's functionalities and whilst it's understandable to compare it to a ListView or a GridView (or event a StaggeredGridView), it shouldn't be confused with them.
With RecyclerView, the responsibilities of handling the "background change" selector relies on the underlying control that the RecyclerView is holding. It's also the same with onClick and many other perks you get for free in a ListView.
Why it is better (or worse) to use a RecyclerView to a ListView is a different matter that I won't go into but to fix your problem, in order to set a background selector on your RecyclerView, add this to the layout that you're inflating in your ViewHolder (i.e. the actual layout that's being used inside the RecyclerView, similar to your "list row item" that you would inflate inside an ArrayAdapter if it were a ListView):
android:clickable="true"
android:background="?android:selectableItemBackground"
Which should set the background appropriately.
Recycler view are recommend when you have very large items & wants to have a custom UI. If you want to display only few items the would recommend to use List View.
I have a custom ListView which checks for a value in its adapter, and if its false it should disable scrolling. The reason I need to do this is because inside the listview are rows of horizontal listviews (using this implementation: https://github.com/dinocore1/DevsmartLib-Android) and if you scroll slightly up or down whilst scrolling on of these horizontal views, they stop scrolling and the listview instead scrolls.
The issue with this code is that it doesn't always seem to prevent the listview from scrolling, and it also doesn't pass the action through to the child (horizontal listview) like I believe it should (passing false).
Does anyone have any idea how I can get it to stop scrolling and still pass the movement action through to the child? Any help would be appreciated.
Thanks.
I have the following question: I have a difficult layout that contain ListView. I need disable scrolling ability for ListView, because it's container (root Layout) have had ScrollView already, and I don't need a scrolls for ListView. I disable scrolls by android:scrollbars="none", but abilitity for scrolling would stay. I need that if ListView has 10 items that all items will be shown. How can I do it?
Can't you just use a LinearLayout with 10 elements instead of the ListView? It is not a good idea to have a ScrollView in another ScrollView.
Why do you still use the ListView? Create your own Layout for an item and load it several times (LayoutInflater, .addView(listItem)).