Xaml 如何在此布局中创建滚动视图?

Xaml 如何在此布局中创建滚动视图?,xaml,xamarin.forms,Xaml,Xamarin.forms,我需要在这个布局中创建一个ScrollView,但问题是我的控件占据了整个屏幕,我不知道如何使它只占据它的大小 我不需要它填满整个屏幕,只需要它自己的大小就可以在布局中添加更多内容 这是我控件的XAML: ,因为您将Stacklayout的高度设置为整个屏幕 AbsoluteLayout.LayoutBounds="0,1,1,1" 因此,这将是一个预期的结果 事实上,在您的例子中,您可以在不使用ScrollView的情况下实现该效果 在ContentPage中 我试图

我需要在这个布局中创建一个ScrollView,但问题是我的控件占据了整个屏幕,我不知道如何使它只占据它的大小

我不需要它填满整个屏幕,只需要它自己的大小就可以在布局中添加更多内容

这是我控件的XAML:


,因为您将Stacklayout的高度设置为整个屏幕

AbsoluteLayout.LayoutBounds="0,1,1,1" 
因此,这将是一个预期的结果

事实上,在您的例子中,您可以在不使用ScrollView的情况下实现该效果

在ContentPage中

我试图用这段代码来实现这一点,但我不知道为什么表情键盘没有出现。只上入口。为什么运动太慢?有没有办法让它更平滑?你需要设置键盘填充自定义控件。填充和展开中的水平和垂直选项?你可以在github上共享你的示例,我会在我这边测试它。我解决了它,有没有办法让它更平滑?看起来像这样:
<AbsoluteLayout BackgroundColor="White" AbsoluteLayout.LayoutBounds="0,1,1,1">
        <!--  -->

        <Button Clicked="Button_Clicked" Text="Test"  AbsoluteLayout.LayoutBounds="0.5,0.3,0.2,0.05" AbsoluteLayout.LayoutFlags="All" />

        <StackLayout x:Name="bottomBar" BackgroundColor="Olive" AbsoluteLayout.LayoutBounds="0.5,1.0,1.0,0.04" AbsoluteLayout.LayoutFlags="All">
            

            <!-- put the content of emoji keyboard and entry here -->

        </StackLayout>
    </AbsoluteLayout>
    bool isShow;
    const double layoutPropHeightMax = 0.45;
    const double layoutPropHeightMin = 0.06;
   //you could set the height here as you want

    private void Button_Clicked(object sender, EventArgs e)
    {
        if(!isShow)
        {
            //show the keyboard

            Device.BeginInvokeOnMainThread(async () =>
            {

                var height = layoutPropHeightMin;

                while (height < layoutPropHeightMax)
                {
                    await Task.Delay(1);
                    height += 0.04;

                    AbsoluteLayout.SetLayoutBounds(bottomBar, new Rectangle(0.5, 1.0,1.0, height));
                }

            });

        }

        else
        {
            // hide the keyboard
            Device.BeginInvokeOnMainThread(async () =>
            {

                var height = layoutPropHeightMax;

                while (height > layoutPropHeightMin)
                {
                    await Task.Delay(1);
                    height -= 0.04;

                    AbsoluteLayout.SetLayoutBounds(bottomBar, new Rectangle(0.5, 1.0, 1.0, height));
                }

            });

        }


        isShow = !isShow;
    }