Question

If I got a graphic design for lets say a TextEdit control as a background image, is it possible to stretch the image when changing from portrait to landscape view?

I'm coming from WEB and with CSS where I could divide the background picture to 3 parts and make the background stretch dynamically. Is something like this possible in android environment or should I use different layouts for each orientation?

Was it helpful?

Solution

You can declare different graphics by dropping them in separate sub-folders of the /res directory in your project. By naming convention, your application will pick them up automatically.

For example, if you use a background image called textBackground.png and you have two versions of it depending on orientation. The app will use res/drawable/textbackground.png by default and res/drawable-land/textBackground.png when in landscape mode, for example.

Check out this doc for the full story:

http://developer.android.com/guide/topics/resources/providing-resources.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top