Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin在Android上形成TranslationY_Android_Xamarin_Xamarin.forms_Xamarin.android - Fatal编程技术网

Xamarin在Android上形成TranslationY

Xamarin在Android上形成TranslationY,android,xamarin,xamarin.forms,xamarin.android,Android,Xamarin,Xamarin.forms,Xamarin.android,我们的应用程序中存在这样一种情况,出于性能原因,我们需要翻译一些内容(以阻止动画期间发生布局更改) 我们发现的问题是,在我们的内容上进行任何翻译都会导致键盘覆盖我们输入的内容。我已经在一个空白的Xamarin表单项目中使用以下MainPage.Xaml复制了这一点 <ScrollView Orientation="Vertical"> <StackLayout Orientation="Vertical" TranslationY

我们的应用程序中存在这样一种情况,出于性能原因,我们需要翻译一些内容(以阻止动画期间发生布局更改)

我们发现的问题是,在我们的内容上进行任何翻译都会导致键盘覆盖我们输入的内容。我已经在一个空白的Xamarin表单项目中使用以下MainPage.Xaml复制了这一点

<ScrollView Orientation="Vertical">
    <StackLayout Orientation="Vertical" TranslationY="60">
        <Entry BackgroundColor="Blue" />
        <Entry BackgroundColor="Black"/>
        <Entry BackgroundColor="Blue"/>
        <Entry BackgroundColor="Black"/>
        <Entry BackgroundColor="Blue"/>
        <Entry BackgroundColor="Black"/>
        <Entry BackgroundColor="Blue"/>
        <Entry BackgroundColor="Black"/>
        <Entry BackgroundColor="Blue"/>
        <Entry BackgroundColor="Black"/>
        <Entry BackgroundColor="Blue" />
        <Entry BackgroundColor="Black"/>
        <Entry BackgroundColor="Blue"/>
        <Entry BackgroundColor="Black"/>
    </StackLayout>
</ScrollView>

在我的像素2XL上,当我点击最后一个黑色条目时,没有任何移动,条目隐藏在键盘后面。如果我在没有TranslationY的情况下执行完全相同的操作,则条目会按预期向上推到键盘上方

我找不到其他关于这方面的帖子。这是一个已知的问题,我们必须解决吗?或者我应该把它作为bug提交给Xamarin

请注意,这似乎在UWP+iOS上都能正常工作,这似乎是android的问题


提前感谢。

对于Android来说,软键盘覆盖是一个已知的问题。您可以尝试用
边距
替换
TranslationY
,以约束StackLayout的位置

<ScrollView Orientation="Vertical">
  <StackLayout Orientation="Vertical" Margin="0,60,0,0">
    <Entry BackgroundColor="Blue" />
    <Entry BackgroundColor="Black"/>
    <Entry BackgroundColor="Blue"/>
    <Entry BackgroundColor="Black"/>
    <Entry BackgroundColor="Blue"/>
    <Entry BackgroundColor="Black"/>
    <Entry BackgroundColor="Blue"/>
    <Entry BackgroundColor="Black"/>
    <Entry BackgroundColor="Blue"/>
    <Entry BackgroundColor="Black"/>
    <Entry BackgroundColor="Blue" />
    <Entry BackgroundColor="Black"/>
    <Entry BackgroundColor="Blue"/>
    <Entry BackgroundColor="Black"/>
   </StackLayout>
</ScrollView>

谢谢您的回复。我们最终确实将其更改为使用边距而不是平移,但我们在动画中使用了它。更改边距会导致布局更改事件,这对于我们来说是不可接受的,因为要移动大量控件。我们选择在动画期间使用平移设置动画,然后在动画完成后切换到边距。谢谢你的回答,只要这是一个已知的问题。