java - Using custom LinearLayoutManager -


i tried use custom linearlayoutmanager (for using wrap content on recyclerview) :

https://github.com/serso/android-linear-layout-manager

also, when compiled, app crash , have error :

java.lang.nosuchmethoderror: android.support.v7.widget.recyclerview$layoutparams.getviewlayoutposition

this xml :

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:custom="http://schemas.android.com/apk/res-auto"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:weightsum="10"     android:orientation="vertical"     android:background="@color/hypred_noir">         <relativelayout             android:layout_width="match_parent"             android:layout_height="0dp"             android:layout_weight="4.5"             android:background="@color/hypred_rouge"             android:layout_gravity="center_vertical">             <android.support.v7.widget.recyclerview                 android:id="@+id/critere_rep_recycler_view_un"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:scrollbarstyle="insideoverlay"                 android:overscrollmode="never"                 android:layout_centerinparent="true">             </android.support.v7.widget.recyclerview>         </relativelayout>         <relativelayout             android:layout_width="match_parent"             android:layout_height="0dp"             android:layout_weight="1">             <view                 android:layout_width="match_parent"                 android:layout_height="0.5dp"                 android:layout_centervertical="true"                 android:background="@color/hypred_grey"                 android:layout_centerinparent="true"/>             <com.ylly.hypred.custom.mytextview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_centerinparent="true"                 custom:font_name="arial-bold.ttf"                 android:background="@color/hypred_blanc"                 android:textcolor="@color/hypred_gris"                 android:paddingright="1dp"                 android:paddingleft="1dp"                 android:text="@string/ou"/>         </relativelayout>     <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="4.5">         <android.support.v7.widget.recyclerview             android:id="@+id/critere_rep_recycler_view_deux"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:scrollbarstyle="insideoverlay"             android:overscrollmode="never"             android:layout_centerinparent="true">         </android.support.v7.widget.recyclerview>     </linearlayout> </linearlayout> 

and code :

recyclerview recyclerviewcritere = (recyclerview) v.findviewbyid(r.id.critere_rep_recycler_view_un); linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(context, linearlayoutmanager.horizontal, false); recyclerviewcritere.setlayoutmanager(linearlayoutmanager); recyclerviewcritere.additemdecoration(new divideritemdecoration(context, null));  drawable drawable1 = context.getresources().getdrawable(r.drawable.hypred_critere_decolmatage); drawable drawable2 = context.getresources().getdrawable(r.drawable.hypred_critere_fouling_test); drawable drawable3 = context.getresources().getdrawable(r.drawable.hypred_critere_biofilm_solutions); drawable drawable4 = context.getresources().getdrawable(r.drawable.hypred_critere_eau); drawable drawable5 = context.getresources().getdrawable(r.drawable.hypred_critere_approche_audit_hypred); drawable drawable6 = context.getresources().getdrawable(r.drawable.hypred_critere_suivi_intallation);  itemdatacritere itemdatacritere[] = {new itemdatacritere("décolmatage", drawable1),         new itemdatacritere("fouling test", drawable2), new itemdatacritere("biofilm solutions", drawable3),         new itemdatacritere("l'eau", drawable4), new itemdatacritere("approche audit hypred", drawable5),         new itemdatacritere("suivi installation", drawable6)};  recyclerviewcritere.setadapter(new mycritereadapter(itemdatacritere)); 

thanks in advance , have day :o)

add build.gradle depencendies:

compile('com.android.support:recyclerview-v7:22.2.0') {     exclude module: 'support-v4' } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -