Posts

Showing posts with the label scroll

Get center visible item of RecycleView when scrolling

Image
Clash Royale CLAN TAG #URR8PPP Get center visible item of RecycleView when scrolling This is what I want: As image above, I want to draw a center line on RecycleView , then get the center item when scrolling (as well as move left or right) Here is my try to draw a horizontal RecycleView : RecycleView RecycleView HorizontalAdapter adapter = new HorizontalAdapter(data); LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); recycleView.setLayoutManager(layoutManager); recycleView.setAdapter(adapter); Is there any way to know which item is moved to center of RecycleView ? And how can I scroll RecycleView to left or right just one position? RecycleView RecycleView Update : I tried to use a scroll listener to get middle position, but it doesn't work as aspect. @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); ...

bootstrap fixed table headers with scrolling body

Image
Clash Royale CLAN TAG #URR8PPP bootstrap fixed table headers with scrolling body New to programming and first time posting here as well. I've got a bit of an issue with my bootstrap table inside a panel. I have a dropdown menu where the user can decide which columns to display. I need to be able to scroll through the table content both vertically and horizontally as more data gets added. This works fine without the scroll bar as bootstrap solves that for me. When i set my table to "display: block" my scroll bar works fine, but now the column headers don't line up nicely anymore. Also when i add more columns to display, instead of adding to the top header row they create a second row. Here i want it to push the content together but still allowing each column to take up as much space as they need and when the table width exceeds it's limit i want the content to scroll horizontally as well. My problem is that my data changes depending on which data the user selects (...

I'm trying multiple labels, use Scrollbar. but, I made a mistake

Image
Clash Royale CLAN TAG #URR8PPP I'm trying multiple labels, use Scrollbar. but, I made a mistake from tkinter import * from tkinter import ttk class TestScroll(object): def __init__(self, master): self.master = master # list self.list = Listbox(self.master, height=10) self.list.grid(row=0, column=0, sticky=NSEW) for x in range(50): self.list.insert(END, str(x) + " row...") # scroll self.scroll = Scrollbar(self.master, command=self.list.yview) self.scroll.grid(row=0, column=1, sticky=NSEW) self.list.configure(yscrollcommand=self.scroll.set) class TestScroll2(object): def __init__(self, master): self.master = master # canvas self.canvas = Canvas(self.master, height=200) self.canvas.grid(row=0, column=0) # frame self.frame = Frame(self.canvas) for x in range(50): ttk.Label(self.frame, text='label' + str(x) + ...