2012-12-18 85 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)並傳入你想要的數字