2013-09-27 58 views
0

我已經閱讀了許多有關這個主題的問題,但沒有找到答案。Scrollview伸展背景Android

問題是我有一個ScrollView作爲mainView在我的xml中,如果我設置了背景它被拉伸。

ScrollView(background)-->content 

我也試過:

Scrollview-->content(background) 

爲了解決我需要包裝的滾動型的LinearLayout裏面的問題。

LinearLayout(background)-->ScrolView-->content 

現在的背景(如果適用於mainLinearLayout)是沒有更加捉襟見肘,但我必須警告:

This ScrollView layout or its LinearLayout parent is possibly useless; transfer the background attribute to the other 

視圖

我想有背景不拉伸也擺脫了這個警告。

可能是我沒有完全理解此查看工作...

感謝您的幫助

回答

0

不是一個漂亮的答案如何。但它應該工作。

  • 您可以在樣式xml文件中設置背景活動。
  • 刪除無用的LinearLayout。
  • 將scrollview的背景設置爲透明。
0

在第一種情況下,使用android:layout_height="wrap_content"爲滾動視圖,它不會拉伸背景圖片了

+0

它仍然是拉伸它... –