Reputation: 1459
My .xml file has the following code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:orientation="vertical"
android:id="@+id/image_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
However, the phone renders images as follows:
Why?
Upvotes: 0
Views: 32
Reputation: 62841
Are you setting a LayoutManager
for the RecyclerView
? See this documentation.
setLayoutManager
void setLayoutManager (RecyclerView.LayoutManager layout)
Set the RecyclerView.LayoutManager that this RecyclerView will use.
In contrast to other adapter-backed views such as ListView or GridView, RecyclerView allows client code to provide custom layout arrangements for child views. These arrangements are controlled by the RecyclerView.LayoutManager. A LayoutManager must be provided for RecyclerView to function.
Upvotes: 1