android - Horizontal RecyclerView below Vertical RecyclerView -


i'm trying implement sort of chat questions(vertical recyclerview) , have answers(horizontal recyclerview) below vertical recyclerview have managed achieve had in mind, however: have now: vertical rv working fine, , horizontal rv on bottom of view; want have is: im want have answers right below vertical rv, expands, if vertical rv has 1 itemview, should right below it, , expands until horiozontal rv reaches bottom of view

<linearlayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">      <android.support.v7.widget.recyclerview         android:id="@+id/verticalrecyclerview"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1"         android:scrollbars="vertical"         app:layout_behavior="@string/appbar_scrolling_view_behavior"/>      <android.support.v7.widget.recyclerview         android:id="@+id/horizontalrecyclerview"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:orientation="horizontal"/>  </linearlayout> 

edit xml to

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">  <android.support.v7.widget.recyclerview     android:id="@+id/verticalrecyclerview"     android:layout_width="match_parent"          android:layout_height="0dp"     android:layout_weight="1"     android:scrollbars="vertical"     app:layout_behavior="@string/appbar_scrolling_view_behavior"/>  <android.support.v7.widget.recyclerview     android:id="@+id/horizontalrecyclerview"     android:layout_width="wrap_content"           android:layout_height="0dp"     android:layout_weight="0.5"     android:layout_gravity="center_horizontal"     android:orientation="horizontal"/>  </linearlayout> 

use code horizontal recyclerview

 linearlayoutmanager layoutmanager = new linearlayoutmanager(this, linearlayoutmanager.horizontal, false);  recyclerview mylist = (recyclerview)findviewbyid(r.id.my_recycler_view); mylist.setlayoutmanager(layoutmanager); 

and vertical recyclerview use

linearlayoutmanager layoutmanager = new linearlayoutmanager(this, linearlayoutmanager.vertical, false);  recyclerview mylist = (recyclerview)findviewbyid(r.id.my_recycler_view); mylist.setlayoutmanager(layoutmanager); 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

angular - Copying node modules to wwwroot AspNetCore -