开发者

creating layouts dynamically and getting control on each layout

开发者 https://www.devze.com 2023-02-11 14:59 出处:网络
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 eac开发者_开发技巧h la

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 eac开发者_开发技巧h layout how to go about it please give me some suggestion


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消