Come impostare RecyclerView layoutManager da XML?Come impostare l'app RecyclerView: layoutManager = "" da XML?
<android.support.v7.widget.RecyclerView
app:layoutManager="???"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
vedere la documentazione: [recyclerview: LayoutManager] (http://developer.android.com /reference/android/support/v7/widget/RecyclerView.html#attr_android.support.v7.recyclerview:layoutManager) –
@dieter_h puoi fornire una risposta wi esempio di GridLayoutManager? –
Puoi usare 'app: layoutManager =" android.support.v7.widget.GridLayoutManager "'. Verranno utilizzati i costruttori con quattro argomenti ('Context',' AttributeSet', 'int',' int'). Secondo la documentazione questo è il _constructor utilizzato quando il gestore di layout è impostato in XML dal layoutManager di attributo RecyclerView. Se spanCount non è specificato nell'XML, il valore predefinito è una singola colonna_ – thetonrifles