开发者

Android: Background with specific size?

开发者 https://www.devze.com 2023-01-11 10:39 出处:网络
I\'m having some trouble trying to create a program for Android 2.1-update1 with a background of a开发者_如何转开发 specific size. It seems that the only option is to scale the image according to the

I'm having some trouble trying to create a program for Android 2.1-update1 with a background of a开发者_如何转开发 specific size. It seems that the only option is to scale the image according to the device screen size/orientation.

Is there a way to create an empty LinearLayout (edit: with a specific size) behind the gui widgets and then set the image as the background of this layout?

-- onik


Yes, by using setBackgroundResource(int), which sets a drawable resource to use as background, which can be coded as android:background or, setBackgroundDrawable(Drawable), which sets a Drawable to use a background. I am just not sure how it will work with a specific size.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号