2013-02-27 57 views
0

我有以下佈局...安卓:Horizo​​ntalScrollBar需要捕捉到下一個項目甚至以小滾動

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<HorizontalScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true"> 
    <LinearLayout 
     android:id="@+id/mygallery" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:orientation="horizontal" 
    > 
     <ImageView 
      android:id="@+id/level1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:scaleType="center" 
      android:src="@drawable/level1" 
      android:layout_weight = "1" 
      /> 
     </LinearLayout> 
</HorizontalScrollView> 

</LinearLayout> 

我遇到的問題是,當我滾動,如果沒有足夠長的時間,它被卡住在中間(圖片瀏覽)。有沒有辦法讓它一直滾動到下一個項目?我甚至爲此使用了正確的工具嗎?

回答

-1

嘗試在Horizo​​ntalScrollView的寬度中使用wrap_content。我希望這可以幫助你。 BestRegards

+0

沒有幫助,我不確定你瞭解我的問題我想滾動整個圖像視圖,並捕捉到下一個中​​間...(對不起,大拇指朝下,但沒有幫助) – Jackie 2013-02-27 19:30:13

+1

嗨,不用擔心,我們在這裏幫助。你有沒有嘗試另一種方式來做到這一點?如果我理解的很好,你需要將一些圖像放在水平佈局中,然後使用滾動來查看所有圖像。可能是你可以使用一個片段,這不完全使用滾動,但你可以在片段之間交換。看看這個文檔http://developer.android.com/training/basics/fragments/creating.html – vgarzom 2013-02-28 01:09:45

+0

我認爲你是在正確的軌道上我需要看看使用HSB ViewPager我認爲... – Jackie 2013-02-28 18:45:45

0

我解決了這個問題,通過使用ViewPager &碎片而不是HSB。

相關問題