PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 18, 2022

[FIXED] Why vertical orientation does not render images vertically?

 November 18, 2022     android, android-recyclerview, vertical-alignment     No comments   

Issue

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:

enter image description here

Why?


Solution

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.



Answered By - Cheticamp
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing