Hey Koders, Nikhil here,
Yesterday I have got a question for creating layout in which component come to next line when width left(or unused) in previous arrangement is less for creating new arrangement..
So i have created it, but it will be little bit confusing for starter… So please try to understand it…
Layout
- We will create tags in
Vertical Arrangement. - We are using
Card View 1to get width of card after setting new text inlabel1. - Remember one thing that property of
Card View 1,labe1and createdDynamic card,dynamic Labelmust be same.
Extension Used
Thanks to yusufcihan for creating such wonderful Extension…
Blocks
AIA
NewLayoutTest.aia (19.6 KB)
APK
NewLayoutTest (1).apk (5.0 MB)
Results
Explanation
- On
screen Initializationi am creatingdynamic Horizontal Arrangementand settinglabel1text to first element of list and called proceduretaglengthcheckerand check that how much tag is created.. - Before moving forward i would like to let you know that in variable
total widthwe store total width that is used in present dynamichorizontal arrangement - In
Clock.timer, first we check that if we addcardview.width - 10tototatwidthis less thandynamic horizontal widththen we will create tag into presentdynamic horizontal arrangementand settotalwidth to totalwidth + cardview.width - 10else if condition is false then it will create newhorizontal arrangementand settotalwidth to cardview.width - 10* - In above point i have decreased -10 from everywhere because i have managed margin of cards and with respect to padding of horizontal arrangement..
- Procedure
tagcreationis used to create tags you can say it layout of tag.. - Clock interval is 10ms
May be its bug
- We will not get width of dynamic component on screen initialization or in any procedure(called on screen initialization not sure about when called from other source).
Is this Topic helpful to you?
- Yes,its wonderful

- No,need improvement





