android – EditText卡住了动画后,活着回滚滚动…?

我面对一个非常有趣但令人厌烦的错误,在我的线性布局中,我已经隐藏了另一个线性布局,使用边距为负数,当用户从列表中选择一个类型时,我将布局布局在前面使用“转换动画”,错误是布局到了有一个编辑文本死了,当我滚动(我的主要布局被滚动视图包围)它活着,当我停止滚动它再次死亡我真的没有判断为什么发生这样的家伙帮助. …

我也粘贴了下面的视频链接,显示我的应用程序的这个烦人的行为

http://www.dailymotion.com/video/xlskk8_android-app-edit-text-error_tech

我的布局xml里面的滚动视图是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="-110dip"
android:layout_marginBottom="5dip"
android:id="@+id/notes_editor"
android:orientation="vertical"
>
<EditText 
android:id="@+id/enter_note" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:maxLines="2" 
android:lines="2">
</EditText>
<Button
android:id="@+id/save_note" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content"
android:text="Save" />

</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-10dip"
android:id="@+id/notes_list"
android:orientation="vertical"
>
</LinearLayout>

</LinearLayout>

按钮下方的空线性布局用于动态添加子视图,其他所有功能正确执行其功能,只有显示此异常行为的编辑文本.

用于动画的代码如下

public void animateEditor()
{
      slider = new TranslateAnimation(0,180 );   
        slider.setDuration(1250);   
        slider.setFillAfter(true);
        notes_list.startAnimation(slider);
        notes_editor.startAnimation(slider);
}

解决方法

你们为什么投票拒绝我的问题?这是有效的问题,经过长时间的搜索,我也找到了答案,这里的问题是当应用slider.setFillAfter(true);代码动画化视图的图像,但不是实际的视图,这就是为什么当我看到他们滑动动画后,他们(编辑文本和保存按钮)卡住了,或者你可以说死亡,不听他们的事件,因为实际的意见是在布局在前面只是他们的形象

我发现这个问题的解决方案是应用以下代码

slider.setFillAfter(false);
slider.setFillBefore(false);
// OR you can directly write
slider.setFillEnabled(false);

然后通过设置动画监听器并使用以下方法显示新位置的实际视图

public void onAnimationEnd(动画a)

通过使用上述方法将视图放置在动画结束时的新位置.而这里还有另一个闪烁的问题,这是由于Android动画侦听器方法中的问题,即在实际动画结束之前被调用,并导致闪烁效果,其棘手的解决方案是将第一行中的以下代码行的public void onAnimationEnd(Animation a)方法

// in my case animation applied to notes_editor so the code will be 
   notes_editor.clearanimation();

所以,如果你不能帮助或不能得到某人的话,那么他们就不要粗鲁

谢谢

相关文章

这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...
这篇文章主要介绍“Android岛屿数量算法怎么使用”的相关知识...
本篇内容主要讲解“Android如何开发MQTT协议的模型及通信”,...
本文小编为大家详细介绍“Android数据压缩的方法是什么”,内...