말로 설명드리기가 어려워서... 동영상으로 댓글 남깁니다 ㅠㅠ;

18.06.21 13:50 작성 조회수 248

0

말로 설명드리기가 어려워서... 동영상으로 댓글 남깁니다 ㅠㅠ;

인프런에는 질문을 남길려면 첨부파일이라던가... 링크기능이 없어서...

부득이하게 동영상을 직접 찍어서... 구글 드라이브에 영상으로 올려놨습니다;죄송합니다;

<동영상 링크>

https://drive.google.com/file/d/1YAoIjjCdAqmyiHcTfsBAcIHB2n7k6yXV/view?usp=sharing

질문의 요지는 다음과 같습니다.

배너영역(좌우롤링) – viewpager

목록영역 – recyclerview

배너영역(좌우롤링) – viewpager

목록영역 – recyclerview

배너영역(좌우롤링) – viewpager

형태로 띄우고자 하는게 목표인데요...

동영상을 보시면 아래 있는 리사이클러뷰는 화면을 올리게 되면...

해당 영역에서만 스크롤이 되어 버립니다;;;

제가 원하는 것은 일반적인 쇼핑몰앱들 처럼 밑으로

순차적으로 요소들이 배치되어 자연스럽게 배치가 되길 원했는데....

스크롤을 내리면 화면이 전체가 내려가는게 아니라...

밑에 리사이클러뷰데로 따로 스크롤이 되버려서요;;

어떤식으로 구현하면 되겠다하는 힌트 또는 자문을 구합니다 ㅠㅠ;

답변 7

·

답변을 작성해보세요.

0

답변 감사합니다 ㅠ; 결국은 리사이클러로 하는거네요 ㅠㅠ;

기초만 가지고 하다보니...

이게 정석으로 레이아웃 구성하는게 맞는건지도 모르겠고;; 정말 난해 하네요ㅜㅜ

사실 말씀주신 "사이클려뷰를 2차원으로 만들어서 특정 아이템 행에다가 horizontal 리사이클러뷰를 넣어주어서"

데로도 이미 해보았습니다 ㅠㅠ

★그런데 정녕 이렇게 하는게 맞는가? 이게 맞는방법인가? 라는 의문이 자꾸 들고 해결되지 않아★에 글을 남겼었는데... 의문이 해소되었네요 ㅠㅠ;

정말 감사합니다. ㅠㅠ

제가 질문 너무 많이 해서 죄송할 따름입니다; 질문안하고 혼자 해결해 보려고 3일간 이것만 했는데..

뭐가 정답인지 몰라서... 이러지도 못하고 저러지도 못했는데 ㅠㅠ; 감사합니다ㅎ;

다음번에는 초급 뿐만 아니라 중급(실무, 많이 쓰이는 부분유주 ㅠㅠ 또는 방향성?) 강좌도 꼭 부탁드리겠습니다.

0

답변 감사합니다 ㅠ; 결국은 리사이클러로 하는거네요 ㅠㅠ;

기초만 가지고 하다보니...

이게 정석으로 레이아웃 구성하는게 맞는건지도 모르겠고;; 정말 난해 하네요ㅜㅜ

사실 말씀주신 "사이클려뷰를 2차원으로 만들어서 특정 아이템 행에다가 horizontal 리사이클러뷰를 넣어주어서"

데로도 이미 해보았습니다 ㅠㅠ

★그런데 정녕 이렇게 하는게 맞는가? 이게 맞는방법인가? 라는 의문이 자꾸 들고 해결되지 않아★에 글을 남겼었는데... 의문이 해소되었네요 ㅠㅠ;

정말 감사합니다. ㅠㅠ

제가 질문 너무 많이 해서 죄송할 따름입니다; 질문안하고 혼자 해결해 보려고 3일간 이것만 했는데..

뭐가 정답인지 몰라서... 이러지도 못하고 저러지도 못했는데 ㅠㅠ; 감사합니다ㅎ;

다음번에는 초급 뿐만 아니라 중급(실무, 많이 쓰이는 부분유주 ㅠㅠ 또는 방향성?) 강좌도 꼭 부탁드리겠습니다.

0

정녕 페이지 넘기는 것을 깔끔하게 사용하고 싶을경유 horizontal 리사이클러뷰를 대신 뷰페이져를 넣어주어도 문제 없을뜻합니다

0

아 질문의 요지를 이해했습니다 이럴 경우 스크롤 뷰안에 뷰페이저와 라시클러뷰를 넣을것이 아니고 리사이클려뷰를 2차원으로 만들어서 특정 아이템 행에다가 horizontal 리사이클러뷰를 넣어주어서 뷰페이저처럼 사용하시면 됩니다 저런 구조로 사용할경우 스크롤뷰가 리사이클러뷰에 가려저서 사용할수가 없습니다

0

그 안에 다시 viewpager(배너)와 recycler뷰가 존재합니다; ㅠ

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools"

xmlns:app="http://schemas.android.com/apk/res-auto"

android:background="#ccc"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent">

<RelativeLayout

android:layout_width="match_parent"

android:layout_height="wrap_content">

<android.support.v4.view.ViewPager

android:id="@+id/main1_viewpager"

android:layout_width="match_parent"

android:layout_height="200dp"></android.support.v4.view.ViewPager>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="160dp"

android:gravity="right"

android:paddingRight="20dp"

android:orientation="horizontal">

<TextView

android:text="1"

android:id="@+id/now_page"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

<TextView

android:text="/"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

<TextView

android:text="5"

android:id="@+id/total_page"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

</LinearLayout>

</RelativeLayout>

<android.support.v7.widget.RecyclerView

android:id="@+id/item_list"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:layoutManager="android.support.v7.widget.LinearLayoutManager"

></android.support.v7.widget.RecyclerView>

0

프레임 레이아웃 안에 다시 탭뷰가 존재하구요...

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

xmlns:app="http://schemas.android.com/apk/res-auto"

tools:context=".fragment.HomeFragment">

<android.support.design.widget.TabLayout

android:id="@+id/main_tablayout"

android:layout_width="match_parent"

app:tabMode="scrollable"

android:layout_height="50dp"></android.support.design.widget.TabLayout>

<android.support.v4.view.ViewPager

android:id="@+id/main_viewpager"

android:layout_width="match_parent"

android:layout_height="800dp"></android.support.v4.view.ViewPager>

0

참고로 동영상 초반에 보시면 따로 놀다가 중반부 이후에 전체가 스크롤이 되는 이유는 (위에 뷰페이져)에서 화면을 끌어 내렸기 때문에 가능했습니다;ㅠㅠ;
참고로 메인엑티비티 레이아웃은 다음과 같습니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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" android:background="#acac">

<ScrollView
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_above="@id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorAccent"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:background="@color/colorPrimary"
            android:id="@+id/main_framelayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </FrameLayout>

    </LinearLayout>

</ScrollView>
<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    app:menu="@menu/bottom_navigation_menu" />