2016-06-22 45 views
-2

我已經使用按鈕作爲單獨的網格進行了滾動視圖。但是,一旦我將按鈕的背景更改爲圖像,視圖就停止滾動。其中一個警告是「主線程上的工作太多」。我想知道爲什麼滾動不起作用了嗎?非常感謝!android無法正常工作的滾動視圖

更新:我發現當我使用較小的圖像尺寸時,錯誤消失了!問題是插入的所有圖像都很大,結果整個程序運行不順利,滾動視圖停止工作。

+0

分享您的代碼將有助於快速解決問題。 –

+0

發佈您的佈局 –

+0

分享您的佈局及活動請登錄: –

回答

1

我也遇到了同樣的問題,並使用較小的圖像作爲背景解決了我的問題。嘗試將圖片替換爲較小的圖片,然後查看它適合您。

+0

我現在通過使用較小的圖片來運行它,謝謝! – hwhong

+0

沒問題:)接受我的答案,如果有幫助:P –

0
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true"> 

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

     <!-- everything you already have --> 

    </LinearLayout> 
</ScrollView> 
+0

不要忘記將ScrollView屬性android:fillViewport設置爲true。這使得子視圖佔據了ScrollView的整個空間 –