How does automatic height work?

I am using a dynamic Label that will only appear after I click a button above:

In a block where I call the content of Airtable, I set the Label text and then set its size to 0 so that it is hidden.


Outside this block of content, when I click the button I reset its size to -1 expecting it to show the text contained.


But nothing happens, even if in this block I pass a new text to the Label

How does height -1 work?

** What I need to do: ** I need to show or hide the Label when I click the button. I already thought about creating or deleting the Label instead of using its height as 0 to hide it, but outside my structure context where I have several For Each, one inside the other, I can’t. Another way would be to be able to somehow create or delete this Label right after the button, but I don’t know if this is possible after the dynamic structure is assembled.

It doesn’t seem as simple as explained here:

Hello @jhonidesb.

First, welcome to the community.

Second, I am not quite familiar with dynamic components, I’m still learning. But I saw this kind of writing in the Decoration component.

There, you use a string block for determining the Page 64 3A Automatic and Fill Parent.

So try with the string block instead of the math block, see if it works or not.


Thank you.
But the “Set Height” Block does not support string values.

First of all I have no idea that why App Inventor uses different constant values from android.The constant values defined/used in android are as follows:
Fill Parent/Match Parent : -1
Wrap Content : -2
Now the constant values used in AI are as follows:
Match Parent/Fill Parent : -2
Wrap Content : -1

In answer to your question:
Fill Parent: it will take all available space
Wrap Content: it will take only required space

In android documentation they are defined as follows:
Fill Parent/Match Parent: Special value for the height or width requested by a View. MATCH_PARENT/FILL_PARENT means that the view wants to be as big as its parent, minus the parent’s padding, if any

Wrap Content: Special value for the height or width requested by a View. WRAP_CONTENT means that the view wants to be just large enough to fit its own internal content, taking its own padding into account.

Thank you!

But these -2 or -1 parameters have no effect.

If I set a fixed size, 100 for example, then the contents of the Label are shown.
Even when I create the Label, if I set its Height to -1, it just disappears.

If you think it is a bug then report it in respective category :slightly_smiling_face:

Also I don’t think setting height as 0 will effect anything.

Thank you.

But I am not qualified to determine whether this is a bug or not.

What it seems is that if the Label height is manipulated with positive values, it will no longer function automatically.

Why not try visibility property of label?

This property does not exist for the dynamic Label.

I thought you are using Dynamic Component extension by Yusuf Cihan :sweat_smile:
Give it a try.It gives you more customization options.

Nice! I will take a look.

Can you tell me where the documentation is?

I’m not sure what parameters and properties it accepts.

Since extension creates a reflection of original component so all properties and methods will behave same.

So I remain restricted to the properties and methods existing in the native components.
Doesn’t that provide more customization options as you mentioned?

No it does not.
But still it has some more customization options than native dynamic components.

Sorry did not understand.

Do you or don’t you?

Does the label on these components have the “Visible” property?