0

Looking around, I see many questions that are very similar but not exactly like mine. The questions I've seen either want to avoid clipping, or clip to some complex path. I just want a simple clip. Here goes.

I want to create an Android app which uses for the background of its various Activies a large photo that cannot be stretched or 9-patched (this is a firm customer requirement). Instead, I just want to provide an image large enough to accommodate the various screen sizes/densities, with excess simply clipped or not displayed - as if it just overflowed the screen.

The images are not patterned or otherwise regular or similar to each other. They are photos indeed, with subjects and ideas presented, so I will of course have to decide which parts are displayed, but I'm not concerned with that right now - just how to approach the problem.

Are there layout XML parameters I can use? Or do I have to cook up a custom layout?

QED
  • 9,803
  • 7
  • 50
  • 87

1 Answers1

0

There's probably a better way, but the immediate thing that came to mind was just to set the image in an image view with a scale type set to not scale, and then to put all your UI elements on top of it with transparent backgrounds. Like this:

<RelativeLayout>
    <ImageView android:width=fill_parent
               android height=fill_parent
               android:scaleType=center />
    //your UI here
</RelativeLayout>
Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Thanks! I'll give it a go a little later this week when the time is right for me. Meantime the visual requirements have changed to abandon the images in favor of a flat background, which *might* make the issue mute. – QED Feb 05 '13 at 06:36