brkckr / TableView

A RecyclerView that looks like a TableView, can scroll horizontally and vertically with a fixed header at the same time.
140 stars 21 forks source link

display from the right of RecyclerView #3

Closed mahramane closed 4 months ago

mahramane commented 4 years ago

Is it possible to display from the right? Help me please. It is very necessary

brkckr commented 4 years ago

I may help if you can give me more details about what you want to do.

mahramane commented 4 years ago

i use android:layoutDirection="rtl"

I want to show the horizontal scrollbar recyclerView from the right for the first time.

mahramane commented 4 years ago

photo_2020-03-21_21-58-21

brkckr commented 4 years ago

As far as I understand, you want RecyclerView to scroll right on the first boot.

manager.smoothScrollToPosition(rvClub, null,0);

manager : FixedGridLayoutManager manager; rvClub : your RecyclerView.

state and the position are not important at this time. keep it null and 0.

mahramane commented 4 years ago

Unfortunately it didn't work 😢

brkckr commented 4 years ago

Then I have no other solution or idea. Good luck. Please let me know when you find the answer.

mahramane commented 4 years ago

Hi How can I use scrollHorizontallyBy in the FixedGridLayoutManager?

brkckr commented 4 years ago

The parameter dx means the change in x coordinate. In your case, you want to move it in the opposite direction. which means dx must be a negative value. But I have no idea about other parameters of scrollHorizontallyBy.

Still, I am not sure if you use manager.smoothScrollToPosition(rvClub, null,0) correctly.

 /**
     * Handles RecyclerView for the action
     */
    private void setUpRecyclerView()
    {
        clubAdapter = new ClubAdapter(MainActivity.this, clubList);

        FixedGridLayoutManager manager = new FixedGridLayoutManager();
        manager.setTotalColumnCount(1);
        rvClub.setLayoutManager(manager);
        rvClub.setAdapter(clubAdapter);
        rvClub.addItemDecoration(new DividerItemDecoration(MainActivity.this, DividerItemDecoration.VERTICAL));

        manager.smoothScrollToPosition(rvClub, null, 0);
    }

I got the following result from physical device, operating system Android 9.

ezgif-3-275bb0cd79b1

monsterbrain commented 4 years ago

Did you tried setReverseLayout(true) ? https://stackoverflow.com/questions/31728837/recyclerview-grow-element-from-right-to-left

SaggamAnand commented 2 years ago

Hi, Could you please help me out? I am trying to add views dynamically (not fixed in size) for each recycler view item, but the problem is after adding views, it's not scrolling horizontally. Attached screenshot for reference Scroll_issue .

brkckr commented 2 years ago

Hi,

Can you give 200dp width to each element you add to the row of the RecyclerView and tell me if it works? The width of each row of the RecyclerView must be wrap_content.

Do you have the 16th, 17th or 20th element in each row?

SaggamAnand commented 2 years ago

Hi, I tried to set a fixed height/width for the row item element, but still, it is not getting scroll. It gets scrolled when we have fixed views in each item of recycler view.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/score_text_view"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true"
        android:gravity="center"
        android:textColor="@color/colorPrimaryDark" />

</RelativeLayout>
brkckr commented 2 years ago

Then I have no other solution. Hope you can solve it.