【发布时间】:2016-04-14 14:18:46
【问题描述】:
这是我的 xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SetYourBudget.HomePage">
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
<Label x:Name="lblImporto" Text="" VerticalOptions="Start" HorizontalOptions="Fill" HorizontalTextAlignment="Center"/>
<ListView VerticalOptions="FillAndExpand" x:Name ="list">
</ListView>
<StackLayout Orientation="Vertical" Spacing="5" VerticalOptions="EndAndExpand" BackgroundColor="#c1c1c1" x:Name="addLayout" Padding="10">
//I remove thrash code
</StackLayout>
</StackLayout>
</ContentPage>
我正在以编程方式为我的addLayout 设置动画,以向下滚动以查看其中StackLayout 的大小。这是代码,它运行良好,他可以向下和向上滚动到原始位置:
private async void BtnDropDown_Tapped(object sender, EventArgs e)
{
if (isVisible)
{
// hide
// addSection is a section of the addLayout, not relevant in the operation it's only the size i need to scroll
await addLayout.TranslateTo(0, addSection.Height + 10);
imgDropDown.Source = Device.OnPlatform("btnMostra", "btnMostra", "btnMostra");
isVisible= false;
}
else
{
//show
await addLayout.TranslateTo(0, 0);
imgDropDown.Source = Device.OnPlatform("btnNascondi", "btnNascondi", "btnNascondi");
isVisible= true;
}
}
现在,我的问题如下:正如您在 xaml 中看到的那样,我有一个名为 list 的 ListView,它位于向下滚动的布局上方。
当我滚动下部布局时,我希望列表“增长”以填充滚动动画释放的大小。
我发布了一个解释性的图像:
(obv 我设置了一些随机数据,因为它只是一个文本。我的目标是了解调整大小)
谢谢大家,对不起我的英语不完美
【问题讨论】:
-
你能解决这个问题吗,我也遇到了同样的问题。
-
@PrakashChennupati 不幸的是没有。最后,我们决定采用原生解决方案而不是使用跨平台。或许this link 能帮到你,抱歉没能解决这个问题!
标签: c# xaml xamarin resize xamarin.forms