안드로이드 개발 질문/답변
(글 수 45,052)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/lay1"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<ImageView
android:id="@+id/bear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bear"
android:paddingRight="10px"
/>
<ImageView
android:id="@+id/hello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/hello"
android:paddingRight="10px"
/>
<ImageView
android:id="@+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/map"
android:paddingRight="10px"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/lay2"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="5"
>
<HorizontalScrollView
android:id="@+id/scr"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</HorizontalScrollView>
</LinearLayout>
</LinearLayout>XML에 위의 코드대로 정의되어 있습니다.
위에는 이미지 넣고 아래는 스크롤뷰를 넣으려고 리니어 레이아웃을 썼습니다.
윗쪽 리니어 레이아웃에 있는 이미지를 아래에 있는 가로스크롤뷰에 넣으려고 합니다.
저대로 해서 실행을 하면
이렇게 화면이 뜨는데 이미지를 터치해서 움직여서 스크롤뷰에 가져가면
이렇게 이미지가 스크롤뷰 뒤로 갑니다.
이미지가 스크롤뷰 위에 위치해서 가로 스크롤이 되게 하고 싶은데
구글링을 해봐도 모르겠습니다.
고수분들의 도움 부탁드립니다.




가장 아래 정의된것이 가장 위쪽에 보입니다.
우선 가장 윗쪽을 Relative로 바꾸시고 스크롤바를 가장 위쪽에 정의하시고 이미지뷰들은 아래쪽으로 정의해서 사용하시거나
아니면 이미지뷰를 xml에 하지마시고 동적으로 생성하신담에 터치 하는 순간 리무브뷰하고 놓는순간 add하시면 될거같아요~~
전 릴레이티브로 스템프들 찍거나 니동하면서 위아래 바꿀대 그방법으로 구현햇었어요~~