Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Incorrect ListCell displays?

$
0
0

Hi,

I've been trying to make some sample/prototype apps with Xamarin.Forms to determine if it's already usable in real projects, and I have come across some issues with my Cells in listviews. Amusingly it goes wrong on both Android and Windows Phone for me (I haven't been able to try iOS yet) but in different ways.

Android:
In Android my issue is that the cells cannot seem to gain any height. I didn't have this issue in Xamarin.Forms 1.0, but since upgrading to both the prereleases and now the released 1.2.2 I do still have this issue. Examples:

Below you can see my cell item having a horizontal padding of 15. I've tried several vertical layoutoptions on both the View and the labels (mainly center and CenterAndExpand, but at this point I'm pretty sure I've tried them all) but it makes no difference. As you see the text gets cut off due to the padding, which turns out is because the padding applies correctly on the top but the cell does not grow in height making it so the bottom is cut off.

`
Label nameLabel = new Label();
nameLabel.SetBinding(Label.TextProperty, TournamentListItem.PROPERTYNAME_Name);
nameLabel.HorizontalOptions = LayoutOptions.StartAndExpand;

        Label prizePoolLabel = new Label();
        prizePoolLabel.SetBinding(Label.TextProperty, TournamentListItem.PROPERTYNAME_FormattedPrizePool);
        prizePoolLabel.HorizontalOptions = LayoutOptions.Fill;

        View = new StackLayout
        {
            Padding = new Thickness(10, 15),
            Orientation = StackOrientation.Horizontal,
            Children = 
                        {
                            nameLabel,
                            prizePoolLabel
                        },
        };`

This is shown even better in the below screenshot, here the listItem contains two layouts vertically with names and images in them, this also used to work but now the listItem still does not expand to fit the cell. This again used to work fine, now it only ever shows the top bit no matter what I do.

Windows Phone 8:
WP8 fares better in these regards, the height does get calculated correctly here, however I cannot seem to get a backgroundcolor on my list items. In the Android screenshot you can see the ListView's background is blue, and the player cells are either green, red or a different blue (As much as you can see them at least, on Xamarin.Forms 1.0 this worked fine on Android but not on WP8). On Windows Phone I cannot get the Background colours in my cells to appear at all, the image in the middle does not appear to be there either.

All in all it should look like the screenshot below, as this is the exact same code except built with Xamarin.Forms 1.0 on Android (The listView having a blue background in the earlier screenshots is a byproduct of me changing it for debugging purposes, so ignore this screenshot having a black background):

Am I really doing something fundamentally wrong here? What has changed since XForms 1.0 that I cannot for the life of me get these list items to work anymore.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>