简体   繁体   中英

Syncfusion SfAutoComplete for Android Xamarin rendering is nearly invisible on Hyper V Emulator

I am successfully using Xamarin Forms, however I decided to try Syncfusion but I cannot get the SfAutoComplete component (or probably any other) to show correctly, very very tiny rendering as per the screenshot, if you can see it! I have added the Android and PCL references as per the docs and my PCL sample code is shown. I also created a new project to ensure any rendering I added was not the cause. I am at a loss!

using Syncfusion.SfAutoComplete.XForms;
using System;
using System.Collections.Generic;
using Xamarin.Forms;

namespace Greetings
{
    public partial class Page1 : ContentPage
    {
        public Page1()
        {
            InitializeComponent();
            ShowPage();
        }

        public void ShowPage()
        {
            SfAutoComplete countryAutoComplete = new SfAutoComplete();
            List<String> countryName = new List<String>();
            countryName.Add("Uganda");
            countryName.Add("Ukraine");
            countryName.Add("United Arab Emirates");
            countryName.Add("United Kingdom");
            countryName.Add("United States");
            countryAutoComplete.AutoCompleteSource = countryName;
            this.Content = countryAutoComplete;

        }
    }
}

使用Hyper V Emulator的屏幕截图

This is silly, the text is so small it cannot be read. I used TextSize="40" and all is well. C# for completeness

countryAutoComplete.TextSize = 40;

You have added AutoComplete directly inside content page so that it takes full screen as its size. This is the reason for improper control rendering.Add countryAutoComplete in anyone of the layout/grid and try to set TextSize for countryAutoComplete.

public partial class Page1 : ContentPage
{
    public Page1()
    {
        InitializeComponent();
        ShowPage();
    }
    public void ShowPage()
    {
        SfAutoComplete countryAutoComplete = new SfAutoComplete();
        List<string> countryName = new List<string>();
        countryName.Add("Uganda");
        countryName.Add("Ukraine");
        countryName.Add("United Arab Emirates");
        countryName.Add("United Kingdom");
        countryName.Add("United States");
        countryAutoComplete.AutoCompleteSource = countryName;
        countryAutoComplete.TextSize = 20;
        StackLayout stack = new StackLayout();
        stack.Padding = new Thickness(50,100,50,100);
        stack.Children.Add(countryAutoComplete);
        this.Content = stack;

    }
}

The TextSize property of AutoComplete is works well. Here I have attached the screenshots of AutoComplete when TextSize is 20 in another one TextSize is 40.

TextSize is 20 - https://i.stack.imgur.com/euNIg.png

TextSize is 40 - https://i.stack.imgur.com/zPbl9.png

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM