Making a container fills all the screen

14 views
Skip to first unread message

Karoui Aous

unread,
Jan 10, 2017, 6:30:24 AM1/10/17
to App Inventor Open Source Development
Hello everybody,

I'm trying to create a new component which is a container that fills all the screen.

I can easily do it for the "Width" using these two lines of code :

MockVerticalArrangement mockVerticalArrangement = new MockVerticalArrangement(formEditor);
mockVerticalArrangement.changeProperty("Width",""+LENGTH_FILL_PARENT);

It works fine for the width, but not for the changing the "Height" property of the container. 

I thought that is a problem with the variable "LENGTH_FILL_PARENT" so I decided to try "LENGTH_PERCENT_TAG".
I was not sure about the way to use it, so I tried 
mockVerticalArrangement.changeProperty("Height",""+(-(100+LENGTH_PERCENT_TAG))); This worked fine on the webdesigner, but when I execute the Apk on the phone, the container and it's children does not appear.

Anyone, does know about the right way to use the LENGTH_PERCENT_TAG ? 
Any help about making the container fit all the screen would be appreciated.

Thank you,

Jos Flores

unread,
Jan 10, 2017, 6:43:30 AM1/10/17
to app-inventor-open-source-dev
Hi Karoui,

any changes you make to a Mock* class will only show in the designer.
Mocks are the classes used to 'mock' the appearance of Android
widgets. If you want the changes to also affect the Android side, you
may have to make changes to the component class that the mock is
'mocking'. Does that make sense? The GWT part (designer) and the
Android part (component) have to be kept in sync, but they are
separate.

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

Karoui Aous

unread,
Jan 10, 2017, 7:13:12 AM1/10/17
to App Inventor Open Source Development
Hi José,

Thank you for this information. Indeed, I am aware of that distinction between changes on "mocks" and "real" components.
So when I use the changeProperty method, I change properties like the user is intended to do on the designer. Then the annotations and internal autoSave methods do the work to make it work on the Android side. (I guess!) 

Miraculously, the "mockVerticalArrangement.changeProperty("Height",""+(-(100+LENGTH_PERCENT_TAG)));" works fine for both sides now. I suppose there was a problem with the buildserver because I restarted it before trying again. Yet, I'm not sure enough. So I will update this post when I find out more ...

Aous

Reply all
Reply to author
Forward
0 new messages