mattneri
mattneri

Reputation: 1

absolute layout or any alternative?

I have to write a complex layout that is built from many ImageViews. Think about a car...I have an image for the car background and then an image for every car component...let's say doors, tyres, lights and I have just to show/hide them in response to the status of the car.

For example, I have two different images for the car doors, open or close and I have to show the "open door bitmap" if the door is open and the "close door" viceversa. So I have to position every bitmap at a particular position.

I'm thinking which is the best layout to use. The easier choice would be an AbsoluteLayout but using it will be a nightmare scale the app to different resolutions. Actually my app is targeted to tablet devices.

I have other choices?

Upvotes: 0

Views: 153

Answers (2)

brianestey
brianestey

Reputation: 8302

You could use RelativeLayout and position the images relative to each other. For example, if you have two images side-by-side, you can use

android:layout_toLeftOf

to position one image just to the left of the other. You can do this for above, below, left or right.

Upvotes: 0

Austyn Mahoney
Austyn Mahoney

Reputation: 11408

I would suggest not using a complex layout and using a Canvas instead. This way your drawing is much more efficient. It will be a little harder, but I don't think you will regret putting in the extra work for what you get out of it.

Upvotes: 1

Related Questions