GridLayout with full-height map and auto-height ListView: Android shrinks the ListView
See original GitHub issueHi,
This is very interesting problem that I cannot easily explain, therefore I’m also providing screenshots.
I have a GridLayout with 2 rows. First row wraps a GoogleMaps view which is full-height (*
). Second row wraps a ListView with auto-height (auto
), which wraps a couple of buttons. The problem is that Android shows only the first button:
http://3.1m.yt/yhAjkBp.png
Here is my layout:
<Page xmlns="http://www.nativescript.org/tns.xsd" xmlns:maps="nativescript-google-maps-sdk" loaded="onload">
<GridLayout rows="*, auto">
<maps:mapView row="0" latitude="{{ latitude }}" longitude="{{ longitude }}" zoom="{{ zoom }}" bearing="{{ bearing }}" tilt="{{ tilt }}" padding="{{ padding }}" mapReady="onMapReady" markerSelect="onMarkerSelect" markerInfoWindowTapped="onMarkerInfoWindowTap" cameraChanged="onCameraChange" />
<ListView items="{{ buttons }}" loaded="listViewLoaded" row="1">
<ListView.itemTemplate>
<GridLayout rows="auto">
<Button id="{{id}}" text="{{name}}" mode="{{mode}}" class="{{ type }}" tap="onButtonTap" row="0"/>
</GridLayout>
</ListView.itemTemplate>
</ListView>
</GridLayout>
</Page>
TNS version 2.5.0 TNS Core Modules version 2.5.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to limit the height of a ListView within a GridLayout?
Save this answer. Show activity on this post. You can programmatically set the height of the ListView as follows: ListView listView = (ListView)...
Read more >GridLayout | Android Developers
For layout purposes, GridLayout treats views whose visibility status is GONE , as having zero width and height. This is subtly different from...
Read more >How To Create a List Grid View - W3Schools
How to create a list grid view. Click on a button to choose list view or grid view. List Grid. Column 1.
Read more >How to create a grid list in Flutter using GridView
Using the GridView class in Flutter, you can show data in a grid format. Learn how you can implement this in your Flutter...
Read more >USS common properties - Unity - Manual
If height is not specified, the height is based on the height of the element's contents. Margins. margin-left: <length> | auto; margin-top: < ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @ickata In my further investigation, I found that this is something expected while setting auto-height (
auto
) to theListView
inside aGridLayout
. This has been related to the fact that to the ListView we should set correct height, which allows us to setup the height for the items.However, for your case, you could use
Repeater
component, which will allow you to create a custom template to bind to it array with the needed content. While using this component the height will be changed will be changed according to the items number. For Example:XML
TypeScript
Hope this helps
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.