안녕하세요..
HorizontalScrollView 관련해서 여쭤볼게 있어서 글을 올렸습니다.
현재 아래의 코드는 HorizontalScrollView 를 사용해서 이미지들을 넣어놓고, 가로형식으로 이리저리 좌우로 움직이
면서사진을 볼수 있는 구조를 만들어 놓았습니다. 총 3가지 입니다.
<뷰페이저가 있는 HappyLife 파일과 , HorizontalScroll이 있는 First_Movie.xml 파일, 그리고 HorizontalScroll이 있는 First_Movie자바파일>
제가 원하는 방향은, 뷰페이지에서 각 이미지들을 클릭하게 될 경우에,
First_Movie 최 하단에 있는, HorizontalScrollView에 각 이미지들이 다르게 나타나는 것입니다.
첫번쨰 이미지 클릭시 a1,a2,a3,a4,a5의 이미지가 HorizontalScrollView에 저장되고 두번쨰 이미지 클릭시
b1,b2,b3,b4,b5의 이미지가 넣어져 있어야 한다는 뜻입니다.
제가 텍스트뷰와 이미지뷰 같은 경우는 뷰페이저에서 클릭시, First_Movie의 파일에서 보듯이 switch를 통해 case문마다,따로따로 구별해서 주었습니다. 이와 똑같이, 스크롤뷰에 넣는 이미지도 switch문에서 textview를 지정하듯이하려고 하는데, HorizontalScrollView는 개별적인것이 아니라, 하나의 뭉텅이어서 어떻게 해야개별적으로 이미지들을 case문에 지정해줄지 잘모르겠습니다.
8000자가 넘으므로 ㅠ 아래에 좀 이어서 달아보겠습니다.
< HorizontalScrollView가 속해있는 First_Movie.xml파일 >
<HorizontalScrollView
android:id="@+id/HorizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/Eight_LinearLayout"
android:layout_marginTop="10dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/a1"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/a2"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/a3"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/a4"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/a5"
/>
</LinearLayout>
</HorizontalScrollView>