• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    해결됨

오류 질문

24.02.28 18:07 작성 조회수 85

0

안녕하세요!

잘 나오던 그림들이 rvAdapter.notifyDataSetChanged()

를 추가하자 안 나옵니다. 뭐가 문젠가요?!

mingreen0107/mango_contents (github.com)

답변 1

답변을 작성해보세요.

0

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    android:layout_margin="5dp"
    android:background="@drawable/radius"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="220dp"
    android:orientation="vertical"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="120dp"
        >
        
        <ImageView
            android:scaleType="fitXY"
            android:id="@+id/rvImageArea"
            android:layout_marginTop="10dp"
            android:src="@drawable/ic_launcher_background"
            android:layout_width="match_parent"
            android:layout_height="120dp"/>

    </androidx.cardview.widget.CardView>



    <TextView
        android:textStyle="bold"
        android:textSize="20sp"
        android:id="@+id/rvTextArea"
        android:layout_marginTop="30dp"
        android:gravity="center"
        android:text="text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>

 

cardView의 크기가 문제인 것 같은데요

이렇게 바꿔보시겠어요?

image

송민주님의 프로필

송민주

질문자

2024.03.02

헉.. 네네 됩니다.

이미지가 너무 컸어서 안 됐던 건가요?

아래는 원래 코드입니다.

<androidx.cardview.widget.CardView 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="10dp"
>

 

cardView 크기를 지정해주지 않아서 잘린 것 같습니다!
잘 안되실 때는
width height를 조정해보고 안쪽의 이미지 크기도 바꿔보시면서 어떻게 xml이 동작하는지 확인해보시면 좋을 것 같습니다!

송민주님의 프로필

송민주

질문자

2024.03.06

넵 감사합니다!