为什么垂直方向不垂直渲染图像?

Why vertical orientation does not render images vertically?

我的 .xml 文件具有以下代码:

<?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>

然而,phone 渲染图像如下:

为什么?

您是否为 RecyclerView 设置了 LayoutManager?看到这个 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.