Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing view background image on orientation change

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?

like image 482
Dimkin Avatar asked Nov 21 '25 10:11

Dimkin


1 Answers

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

like image 146
Rich Avatar answered Nov 24 '25 01:11

Rich