Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么垂直方向不垂直渲染图像?_Android_Android Recyclerview_Vertical Alignment - Fatal编程技术网

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

Android 为什么垂直方向不垂直渲染图像?,android,android-recyclerview,vertical-alignment,Android,Android Recyclerview,Vertical Alignment,My.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="@+

My.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>
但是,手机会按如下方式渲染图像:

为什么?

您是否正在为RecyclerView设置布局管理器?看这个

setLayoutManager

void setLayoutManager回收视图。LayoutManager布局

设置此RecyclerView将使用的RecyclerView.LayoutManager

与其他适配器支持的视图(如ListView或GridView)不同,RecyclerView允许客户端代码为子视图提供自定义布局安排。这些安排由RecyclerView.LayoutManager控制。必须提供LayoutManager才能使RecyclerView正常工作


我认为您必须与我们共享您的适配器和适配器项布局。