-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
미해결
RecyclerView 생성 관련 질문 있습니다.
23.11.11 19:28 작성 조회수 109
0
RecyclerView 를 만들어 , 아이템목록을 HomeFragment 화면에 띄우게 하려면, 어떻게 해야할까요?
HomeFragment.xml에 recyclerview 를 추가하고 , ContentListActivity의 내용을 HomeFragment에 옮기고 , Adapter 연결또한 HomeFragment 와 연결해주면 가능한가요? 직접 해보니 잘 안돼서 질문드립니다.
답변을 작성해보세요.
0
개복치개발자
지식공유자2023.11.12
말씀주신 것 처럼 시도해보셔도 좋을 것 같은데
혹시 시도를 해보셨나요?
만약 시도를 해보시고, 잘 안되시면 시도하신 방법과 코드를 함께 첨부해주시면 좀 더 도움드리기 좋을 것 같습니다~
이기혁
질문자2023.11.13
개복치개발자님! 이렇게 시도해서 성공을 했는데, 여러개의 아이템을 넣어서 실행시켜보니, 스크롤시에 아이템이 하단바를 덮어쓴채로 스크롤이 되어 문제가 발생합니다. 리싸이클러뷰의 항목들만 스크롤을 하게 하려면 어떻게 수정해야할까요? 아래 그림처럼 나옵니다.
FragementHome.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.HomeFragment">
<!-- TODO: Update blank fragment layout -->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="80dp"></androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent">
<ImageView
android:id="@+id/hometab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/sell_list"></ImageView>
<ImageView
android:id="@+id/chattab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/chat_img"></ImageView>
<ImageView
android:id="@+id/settingstab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/settings"></ImageView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</layout>
개복치개발자
지식공유자2023.11.13
recyclerView에 margin_bottom / padding_bottom을 이용해서
recyclerView 하단의 여백을 줘보시겠어요?
답변 1