i have to create a layouts dynamically depending on the some action for example depending on action i have created 5 layouts which is horizontal scroll and i want the control of each layout how to go about it please give me some suggestion
Asked
Active
Viewed 1,673 times
2 Answers
0
Your requirement is not entirely clear. If you want to load layouts from a xml resource fiel you can use LayoutInflater. This will also return a handle to the loaded layout that you can use for further manipulation.
-
using layoutinflater i have loaded 5 layouts using a forloop but iam not getting the handler for each individual layouts iam getting the handler for the first layout only – user571423 Feb 18 '11 at 08:57
-
Did you read the link I've supplied? it describes how you can get the handles. If specific code is your problem you'll need to show us the code. – andig Feb 18 '11 at 13:46
0
You should use the layoutInflater to load the layout.xml files, later in List add the handlers in for loop.
unless you set the inflated layouts to some Activity to display it has no effect. Hence consider ViewStub and inflate the things inside the ViewStub.
If you are inflating and adding it as a part of some component ( like listView items), then you can get the references using a global ArrayList, to store all those handles.
I am unable to understand your question fully, can you please elaborate your problem?

Ganesh Bhat
- 243
- 2
- 10
-
i have linear layout inside this linear layout i have to put dynamically some N numbers of linear layout which should be scrolled horizontal at a time i will be viewing one layout if i scroll then next window will viewed i want handler for each viewing layout – user571423 Feb 18 '11 at 12:02
-
You should not be inflating and adding inside linear layout. Instead use the view flipper. Use showNext() to show next layout, call setDisplayedChild(index) to show a given child with index. As the ViewFlipper is a ViewGroup, you can use getChildAt(), getChildCount() to iterate it throgh as well. – Ganesh Bhat Aug 16 '11 at 09:05
-