0

I am working on RecyclerView which is having ListView as the list item. I am using LinearLayoutManager for RecyclerView. ListView is having lots of data which scrolls horizontally and vertically. But in my case At the time of Portrait mode it stops scrolling vertically and in landscape mode, it stops the horizontal scroll. The requirement is not possible to change. Is there any suggestion to manage this problem. I am attaching some part of my code.

List Item:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/info_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:elevation="5dp"
android:orientation="vertical"
android:visibility="visible">

<View
    android:id="@+id/line"
    android:layout_width="match_parent"
    android:layout_height="2px"
    android:background="@color/table_item_even" />

<ListView
    android:id="@+id/lst_info"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:divider="@null"
    android:dividerHeight="0dp"
    android:scrollbars="horizontal|vertical"
    android:transcriptMode="alwaysScroll"></ListView>

RecyclerView:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_multiprobs_info"
    android:layout_width="match_parent"
    android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>

LinearLayoutManager oriantation change mode:

 if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        } else {
            layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        }
Jaymin
  • 2,879
  • 3
  • 19
  • 35

1 Answers1

1

I forget to do below technique. A very simple method overriding saved my program.I was only focusing on RecyclerView not on LayoutManager that was a mistake.

 layoutManager = new LinearLayoutManager(context){
        @Override
        public boolean canScrollVertically() {
            return false;
        }

        @Override
        public boolean canScrollHorizontally() {
            return false; 
        }
    };