我想使用背景圖片,但我不知道必須爲不同大小的android設置大小,有幾個規範是您可以告訴我您需要使用像素大小。我的應用程序在主佈局用於背景的尺寸是多少?
回答
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/your_selected_background_image"
>
android:layout_width="fill_parent"
和android:layout_height="fill_parent"
屬性將填補你的應用程序與你在任何設備上完全選擇的圖像背景。
謝謝,我會試試 – diez
不用客氣@diez。讓我知道這是你想要的。在我看來這將解決你的問題。 –
使用NinePatch圖像。
NinePatch是一個PNG圖像,您可以在該圖像中定義Android在視圖內的內容超出正常圖像範圍時可伸縮的區域。您通常將這種類型的圖像指定爲至少有一個尺寸設置爲「wrap_content」的視圖的背景,並且當視圖增長以適應內容時,Nine-Patch圖像也會縮放以匹配視圖的尺寸
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/myninepatch" />
http://developer.android.com/guide/topics/resources/drawable-resource.html#NinePatch
據Android開發者文檔FILL_PARENT在API級別8或更高更名爲match_parent,這是推薦使用match_parent代替FILL_PARENT的。 math_parent/fill_parent可以使視圖的大小伸展到其父級的大小,所以如果在背景佈局中使用android:layout_width =「math_parent」和android:layout_height =「match_parent」。您的背景圖片會自動拉伸至您的屏幕尺寸(準確地說,取決於其父母的尺寸)。 wrap_content使視圖的大小足夠大以包含其有效性。因此,使用wrap_content時,視圖的大小和背景將根據視圖的內容展開。
- 1. Android - 標題的背景圖像的尺寸應該是多少?
- 2. 視頻背景的最大尺寸是多少?
- 3. 背景圖像的尺寸
- 4. Android應用程序中背景圖像的正確尺寸是多少?
- 5. 用於繪圖的UiView尺寸是多少?A4尺寸紙張的文件是多少?
- 6. 無論顯示器的尺寸是多少,我如何使背景適合屏幕的全尺寸?
- 7. 尺寸背景圖片?
- 8. 離子全尺寸背景
- 9. Android壁紙/背景尺寸
- 10. 問題背景尺寸
- 11. 背景圖片尺寸
- 12. iOS背景圖片尺寸
- 13. pygame的圖像尺寸是多少?
- 14. SYSJOBID的最大尺寸是多少?
- 15. DataGridView的最大尺寸是多少?
- 16. 手柄的尺寸是多少?
- 17. RTP頭的最大尺寸是多少?
- 18. `show collections`返回的尺寸是多少?
- 19. Cookie的最大尺寸是多少?
- 20. iPhone plist的尺寸是多少?
- 21. Web.config的最大尺寸是多少?
- 22. UINavigationBar titleView的最大尺寸是多少?
- 23. 320 and Up Framework - 600尺寸是多少?
- 24. 適用於iOS和Android的背景尺寸
- 25. 適用於Android的背景圖像尺寸
- 26. 調整SVG背景圖像的尺寸
- 27. 屏幕尺寸的背景圖像
- 28. ninepatch背景的理想尺寸
- 29. Div背景圖像的最大尺寸
- 30. 背景 - 尺寸覆蓋式的自舉
背景圖像是否像可以重複的瓷磚? – tbruyelle