• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

item들의 간격이 너무 크게 나옵니다

23.03.19 18:41 작성 조회수 504

0

 

이렇게 너무 아이템들이 각각 크게 나오는데 이런경우는 뭐가 문제일까요?

 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
         />

</androidx.constraintlayout.widget.ConstraintLayout>

위의 코드는 activitymain의 layout입니다

답변 2

·

답변을 작성해보세요.

1

주코딩님의 프로필

주코딩

2024.02.19

방금 저도 똑같은 상황이라 무엇이 문제였는지 몰랐는데

혹시 몰라 xml 파일을 보니 rv_item.xml에 LinearLayout 자체 height설정을 못했었네요 한번 확인해보세요!

0

Acitivity 의 xml 파일 말고 item의 xml에서

layout_height 를 100dp 이런식으로 사이즈를 조절해보시겠어요?

잘 모르시겠으면 xml 코드를 공유해주세요~

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/rvItem"
        android:text="rv"
        android:textSize="20sp"
        android:layout_margin="20dp"
        android:layout_width="wrap_content"
        android:layout_height="100dp"/>

</LinearLayout>

layout_height 를 100dp로 조절한 코드입니다 그런데도 너무나도 크게 나오네요

현재 화면을 보여주시겠어요?