久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

EditText 在動畫后卡住并在滾動時重新活著......?

EditText stucks after animation and alive back on scrolling......?(EditText 在動畫后卡住并在滾動時重新活著......?)
本文介紹了EditText 在動畫后卡住并在滾動時重新活著......?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我面臨一個非常有趣但令人討厭的錯誤,在我的線性布局中,我使用負邊距隱藏了另一個線性布局,當用戶從列表中選擇一種類型時,我使用平移動畫將布局置于前面,錯誤是布局來到前面有一個編輯文本,它變得死了,當我滾動時(我的主要布局被滾動視圖包圍)它變得活躍,當我停止滾動時它又變得死了......我真的無法判斷為什么會發生這種情況,所以伙計們請幫忙....

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

我在滾動視圖中的布局 xml 是

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.

用于動畫的代碼如下

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

推薦答案

這里的問題是當應用 slider.setFillAfter(true); 代碼動畫視圖的圖像而不是實際的視圖為什么當我在滑下動畫后看到它們時它們(EditText 和保存按鈕)卡住了,或者你可以說死了而不聽他們的事件,因為實際的視圖在布局后面,而在前面它只是他們的圖像

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 see them after sliding down animation they were (EditText 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 the new place by setting animation listener and using the following method:

public void onAnimationEnd(Animation a)

使用上述方法在動畫結束時將視圖放置到新位置.這里還有另一個閃爍問題,這是由于 android 動畫偵聽器方法中的問題,即它在實際動畫結束之前被調用并導致閃爍效果,一個棘手的解決方案是將以下代碼行放在第一行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();

這篇關于EditText 在動畫后卡住并在滾動時重新活著......?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 亚洲国产成人av好男人在线观看 | 国产一区二区三区视频免费观看 | 精品久久久久久久久久久 | 在线视频国产一区 | 亚洲视频在线播放 | 欧美性乱 | 精品在线 | 国产成人精品一区二 | 九九亚洲| 麻豆久久久9性大片 | 免费99视频 | 日韩欧美中文 | www国产成人免费观看视频,深夜成人网 | 亚洲视频一区在线观看 | 免费黄色av| 免费看a| 中国一级特黄视频 | 中文字幕日韩一区 | 久久久久久久久99 | 成人免费看片网 | 成人免费在线观看 | 91av在线影院| 精品国产aⅴ | 亚洲国产欧美日韩 | 一级免费看 | 欧美精品一区二区蜜桃 | 中文字幕日韩欧美一区二区三区 | 久色视频在线观看 | 少妇一级淫片免费放播放 | 午夜天堂 | 欧美高清视频一区 | 亚洲一区| 日本一区二区三区在线观看 | jⅰzz亚洲| 成人在线视频免费看 | 国产精品国产a级 | 国产一区二区在线视频 | 久久久久一区二区三区 | 国产精品123区 | 天天干视频网 | 一区二区国产精品 |