I have a FrameLayout that will hold a set of ImageViews. I'm using FrameLayout because I actually want them to overlap. However, as I add items to the Layout I don't want them to just stack. I actually need to order them.
The image are pulled form storage and I have their correct order stored in my database so:
Image1 - layerNumber: 3
Image2 - layerNumber: 12
Image3 - layerNumber: 1
Image4 - layerNumber: 34
Image5 - layerNumber: 6
Image6 - layerNumber: 30
When I place them in the FrameLayout I'll need to them to in the Layout in the layerNumber order. Also, I'll be adding one or more at a time as I use the app. I may tab something that adds "Image50 - layerNumber: 10".
What I was hoping to do was use something like ImageView.setChildOrder(x) or something like that. Is there any way of doing this?
----- edit ----- per @fifarunnerr I did something like this:
productLayers.addView(productIV, Integer.parseInt(productItem.get(1)));
productItem.get(1)
is just the layerNumber. For this example it's on layer 23.
I get the error: java.lang.IndexOutOfBoundsException: index=23 count=3
I understand the error: I'm trying to place a view in a layout that has 3 "spots" at the 23rd spot. As you can see in my numbers from earlier, the layerNumber won't always be in a 1..2..3..4... pattern.