기본적으로 스크롤 할 때 스크롤 뷰 (페이지)의 각 보이는 부분이 다음으로 스크롤되는 onTouch 이벤트를 모니터링하여 수평 스크롤 뷰를 갖습니다. , 그냥 표준을 가지고보다 ScrollView
. iOS의 페이지 된 scrollviews를 참조하십시오).horizontalalscrollview 수평 요소 스크롤 폭을 채우기 위해 자식 요소를 설정합니다.
이제 내부 자식이 scrollview ("fill_parent"
으로 설정)와 동일한 너비를 상속 받도록하는 방법을 찾고 싶습니다.
<HorizontalScrollView
android:id="@+id/scrollview"
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="1"
android:background="@drawable/scrollviewbg">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView
android:src="@drawable/content1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/content3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
당신이있는 ScrollView가 fill_parent
폭으로 설정되어 볼과 내부 LinearLayout
이 수 있듯이. 이제는 화면 너비와 비슷한 너비와 높이가 설정된 세 개의 이미지가 있지만, 내가 원하는 것은 3을 변경하는 것입니다. LinearLayout
s.
각 LinearLayout
은 스크롤보기와 동일한 너비를 상속해야하므로 코드가 적용될 때 각 페이지가 전체 "페이지"를 차지합니다.
어떻게하면됩니까? 코드를 사용하여해야 할 일이 있습니까? 필요한 코드는 무엇입니까?
감사합니다.
위해 시도 할 수 있습니다. 고마워. :) –
지원 라이브러리를 사용하는 옵션이 없으므로 scrollview에서 할 수 있습니까? – user606669