的EditText stucks动画和活着回来滚动后......?动画、EditText、stucks

2023-09-12 10:18:07 作者:哈利波特别大

我现在面临一个非常有趣的,但恼人的错误,在我的线性布局我已经藏起来使用保证金另一个线性布局负,当用户从列表我带来布局,使用平移动画前一类型的错误是布局谈到前有变成死的,当我滚动(我的主要布局由滚动视图包围),它活了过来,当我停止滚动再次成为死了......我真的无法判断为什么会这样让你们的编辑文本plz帮助....

我也贴在下面显示我的应用程序的这种令人讨厌的行为视频的链接

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

我里面滚动视图布局XML是

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=垂直
>

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =10dip
机器人:layout_marginRight =10dip
机器人:layout_marginTop = -  110dip
机器人:layout_marginBottom =5dip
机器人:ID =@ + ID / notes_editor
机器人:方向=垂直
>
<的EditText
机器人:ID =@ + ID / enter_note
机器人:layout_height =WRAP_CONTENT
机器人:layout_width =FILL_PARENT
机器人:MAXLINES =2
机器人:行=2>
< /的EditText>
<按钮
机器人:ID =@ + ID / save_note
机器人:layout_height =WRAP_CONTENT
机器人:layout_width =WRAP_CONTENT
机器人:文本=保存/>

< / LinearLayout中>

< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop = -  10dip
机器人:ID =@ + ID / notes_list
机器人:方向=垂直
>
< / LinearLayout中>

< / LinearLayout中>
 

下面的按钮空的线性布局用来动态地添加子视图所有其他的事情都是正确履行自己的功能,只显示该异常行为的编辑文本。

用于动画的code低于

 公共无效animateEditor()
{
      滑块=新TranslateAnimation(0,0,0180);
        slider.setDuration(1250);
        slider.setFillAfter(真正的);
        notes_list.startAnimation(滑盖);
        notes_editor.startAnimation(滑盖);
}
 

解决方案

你们为什么ü否决了我的问题?它是有效的问题和漫长的寻找后,我找到了自己的答案也一样,这个问题将在这里是 slider.setFillAfter(真); 的code动画浏览的图像但不是实际的意见,这就是为什么,当我看到他们滑下动画完成后,他们(编辑文本和保存按钮)卡住或者可以说死了,不听他们的活动,因为实际的意见是有布局的背后和前面这只是他们的形象

解决方案,我发现这个问题是采用以下code

  slider.setFillAfter(假);
slider.setFillBefore(假);
//或者你可以直接写
slider.setFillEnabled(假);
 
孩子,如果早晚都要死去,为什么还要活着 这组漫画一夜之间刷爆了的朋友圈

和然后通过设置动画听者,并使用以下方法显示在新的地方实际视图

公共无效onAnimationEnd(动画)

将在动画结束的观点,以新的位置用上述方法。在这里,仍然来自闪烁的另一个问题,就是由于android的动画侦听器方法的问题,这是它得到实际动画结束前调用,并导致闪烁效果,一个棘手的解决方案,它是由推杆code以下行在公共无效onAnimationEnd的第一行(动画)方法

  //在我的案件的动画应用到notes_editor因此code会
   notes_editor.clearAnimation();
 

这样的家伙,如果你不能帮助或没有得到别人的观点,那么请不要粗鲁地对待他们。

感谢

I am facing a quite interesting but annoying error, in my linear layout i have hided another linear layout using margin in negative and when user selects a type from a list i bring layout to front using Translational Animation the error is that the layout comes to front have an edit text which becomes dead and when i scroll (my main layout is surrounded by scroll view) it comes alive and when i stop scrolling it becomes dead again... i really failed to judge why is this happening so guys plz help....

i have also pasted link of video below showing this annoying behavior of my app

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

my layout xml inside scroll view is

<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>

the empty linear layout below button is used for dynamically adding child views all other things are performing their functionality properly, only the edit text showing this abnormal behavior.

the code used for animation is below

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

解决方案

guys why u voted down my question? it was valid question and after long search i found its answer too, the problem here was when applying slider.setFillAfter(true); the code animates the image of Views but not the actual Views that's why when i seen them after sliding down animation they were(Edit text and save button) stuck or you can say dead and not listening to their events because actual Views were there behind the layout and at front it was just their image

the solution i found for that problem is to apply following code

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

and then to show actual views on new place by setting animation listener and using the following method

public void onAnimationEnd(Animation a)

placing the views to new position at the end of animation by using above method. And here still comes another problem of blinking which is due to the problem in android animation listener method which is that it is get called before actually animation ends and causes blinking effect, a tricky solution to it is by putting following line of code at first line of public void onAnimationEnd(Animation a) method

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

so guys if you can't help or not getting someone's point then don't be rude to them

thanks