水平滚动视图左,右箭头显示问题? [英] Horizontal Scroll view left right arrow display problem?
问题描述
我有一个水平滚动视图,有如果用户滚动进一步的图像都可以比我需要显示右侧的右箭头,指示用户重新滚动,看看其他的图像。
I have one horizontal scroll view in that there are images if user scroll and further images are available than I need to display right side right arrow to indicate user to scroll it again and see other images.
在此先感谢。
推荐答案
我刚刚碰到这个问题,我才明白,你可以使用滚动型淡入淡出功能用于此目的。只需使用相对布局,其中有3个观点:LEFTARROW,RIGHTARROW,horizontalscroll。设置fadingEdgeLength到足够的长度,所以当滚动视图淡出,箭头就会出现。
I've just came across this problem and I realized, that you can use scrollview fade function for this purpose. Simply use relative layout in which you have 3 view: leftarrow, rightarrow, horizontalscroll. Set fadingEdgeLength to sufficient length, so when the scrollview fades out, arrow will appear.
例:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:src="@drawable/arrow_l"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
<ImageView android:src="@drawable/arrow_r"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
<HorizontalScrollView android:id="@+id/horizontalScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:fadingEdgeLength="20dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/harokLayout"
android:background="#EEEEEE"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
<ImageView android:src="@drawable/icon" android:layout_height="wrap_content" android:layout_width="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
这篇关于水平滚动视图左,右箭头显示问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!