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 1
to get width of card after setting new text inlabel1
. - Remember one thing that property of
Card View 1,labe1
and createdDynamic card,dynamic Label
must 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 Initialization
i am creatingdynamic Horizontal Arrangement
and settinglabel1
text to first element of list and called proceduretaglengthchecker
and check that how much tag is created… - Before moving forward i would like to let you know that in variable
total width
we store total width that is used in present dynamichorizontal arrangement
-
In
Clock.timer
, first we check that if we addcardview.width - 10
tototatwidth
is less thandynamic horizontal width
then we will create tag into presentdynamic horizontal arrangement
and settotalwidth to totalwidth + cardview.width - 10
else if condition is false then it will create newhorizontal arrangement
and 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
tagcreation
is 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
0 voters