2012-12-18 89 views
1

我有一个水平滚动视图附加了一些活动的图像视图,我希望当加载活动时,水平滚动视图中的图像应该从左到右移动,就像横幅形式一样。继续旋转水平滚动视图

这是可能的android?

感谢

回答

0

添加一些图像文件放入res /文件夹绘制并使用以下布局:

<?xml version="1.0" encoding="utf-8"?> 
<HorizontalScrollView 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 

> 
<LinearLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" 
> 



<ImageView 
    android:src="@drawable/pic1" 
    android:id="@+id/img1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 


<ImageView 
    android:src="@drawable/pic2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
<ImageView 
    android:src="@drawable/pic3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
<ImageView 
    android:src="@drawable/pic4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
</LinearLayout> 
</HorizontalScrollView> 
+0

请再次阅读问题 –

+0

哦,对不起,我犯了一个错误,我会尝试找到一个解决方案为你的问题 – 2012-12-18 12:02:18

0

我相信这是可能的。滚动视图类中有一个设置位置

http://developer.android.com/reference/android/widget/ScrollView.html#smoothScrollBy(int,INT)

,可以帮助你的方法。我知道你可能想要改变速度,我正在看我是否看到了解决方案。我还没有试过我看到了这只是我自己的方法在传递

这也可能是有益的

scrollTo(INT X,int y)对

你也许可以在不同的线程计算,其中x应该是每隔30秒,然后调用scrollTo(int x,int y)并传入你想要的数字