滚动型向下滚动和攻丝的EditText有焦点的时候,突然向上滚动回 [英] ScrollView scrolling down and suddenly scrolling up back when tapping on EditText to have focus

查看:128
本文介绍了滚动型向下滚动和攻丝的EditText有焦点的时候,突然向上滚动回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个滚动型。里面,我有卡般的布局,有EditTexts。我的问题是,当我滚动了滚动型,并在一个卡上的EditText的一个水龙头,滚动型的第一向下滚动,然后突然像被覆盖着的SoftKeyboard后面的EditText再向上滚动。当有重点的EditText然而,这才会发生。如果是焦点不已,认为重新安排,只发生时被覆盖着的SoftKeyboard的EditText。

I have a ScrollView. Inside it, I have cards-like layout which have EditTexts. My Problem is when I scroll up the ScrollView and tap on one of the EditText in one of the cards, the ScrollView scroll down first and then suddenly scroll up back again like the EditText is being covered with SoftKeyboard. This is only happen when there is focus in EditText yet. If there is the focus already, the view re-arranging only happens when the EditText is being covered with SoftKeyboard.

据我所知,向上滚动滚动型时的EditText正在
  布满SoftKeyboard。但是,为什么滚动视图尝试重新安排
  在EditText上的位置,即使它不被覆盖着
  SoftKeyboard?

I understand the scrolling up of ScrollView when the EditText is being covered with SoftKeyboard. But, why the scrollview tries to re-arrange the position of the EditText even it is not being covered with SoftKeyboard ?

用户仍然可以看到他正在打字。但是,这是伤害用户体验。

The user can still see what he is typing. But, that is hurting the user-experiences.

我使用的是adjustPan为windowsSoftInputMode。但是,我已经试过任何在此属性可用。它是相同的。

I am using the "adjustPan" for "windowsSoftInputMode". But, I have tried whatever available in this attribute. It is the same.

我甚至尝试与滚动型复制在不同的布局根容器和一帮EditTexts的。但是,那么,这是正常工作。

I even tried to replicated in separate layout with ScrollView as root container and a bunch of EditTexts. But, then, it is working properly.

最奇怪的是,向下滚动,突然向上滚动回(上述)不发生上
  最上面的卡。

The weirdest thing is that scrolling down and suddenly scrolling up back (mentioned above) doesn't happen on the topmost card.

我想了解的是重新编排的观点是如何发生的滚动型,如果有的EditText索要requestFocus的,当用户敲击虽然没有焦点呢。

请让我知道如果你碰到这种怪事之前。

Please let me know if you have bumped into this kind of weirdness before.

推荐答案

如果有人曾经遇到过有这种情形的,这里是我发现后几乎2天病。

If someone ever come across with this kind of scenario, here is what I have found out after almost 2 days of sickness.

为什么发生这种情况的原因是我使用的 translationY 以动画卡片运动。而当卡那translationY值不是在相同作为实际位置卡被容器(包括TOPMARGIN&安培;高度)中定义的,当你把重点投入的EditText这种容器内,突如其来的动作(推的EditText到屏幕的底部,然后推回那的EditText视图上SoftKeyboard顶部)的滚动型(这是卡根容器)的发生。

The reason why this is happening is I am using translationY to animate the movement of the cards. And when that translationY value of the card is not the same as the actual position of the card being defined inside the container (including topMargin & height), when you put the focus into EditText inside this kind of container, the sudden movement(push the EditText into bottom of the screen and then push back that EditText view to be on top of SoftKeyboard) of the ScrollView (which is the root container of the cards) happens.

我还是已经得到为什么发生这种情况的任何想法。但是,我相信在 requestFocus的方法实现的东西,以确保观是对SoftKeyboard之上做的 translationY值

I still have got any idea why this is happening. But, I do believe the requestFocus method implementation is something to do with translationY value in order to make sure the View to be on top of SoftKeyboard.

这篇关于滚动型向下滚动和攻丝的EditText有焦点的时候,突然向上滚动回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆