我面临着关注我的应用程序的问题。我试图抓住点击事件来动画我的编辑文字,但由于某种原因我不明白,有时我的编辑文字会集中,但click event
没有被触发。
用户必须单击第二次才能开始动画。
我AutocompleteTextView
中有2 SherlockFragment
。
是否有可能来自animation
我在做什么?
编辑:
mEtWhere.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "mEtWhere've been clicked");
if (!mllWhereHasBeenClicked) {
mllWhereHasBeenClicked = true;
if (mAlphaFrameLayout != null) {
animate(mAlphaFrameLayout).setDuration(ANIM_DURATION / 2).alpha(0.9f);
}
if (mllWhere != null) {
oldllWhereYpos = ViewHelper.getY(mllWhere);
Log.v(TAG, "OldYWhereLLpos: " + oldllWhereYpos);
animate(mllWhere).setDuration(ANIM_DURATION).y(25.0f);
mBringToFrontView(mllWhere);
}
}
}
});
这是重置所有edittexts位置的代码
private void resetPositionViews() {
closeKeyBoard();
if (mAlphaFrameLayout != null && ViewHelper.getAlpha(mAlphaFrameLayout) > 0.0f) {
animate(mAlphaFrameLayout).setDuration((7 / 4) * ANIM_DURATION).alpha(0.0f);
mBringToFrontView(mAlphaFrameLayout);
}
if (ViewHelper.getY(mllWho) == 25.0f && mEtWho.isFocused() && mllWhoHasBeenClicked) {
Log.i(TAG, "mEtWho has the focus");
Log.i(TAG, "Back to oldllWhoYpos: " + oldllWhoYpos);
animate(mllWho).setDuration(ANIM_DURATION).y(oldllWhoYpos);
mllWhoHasBeenClicked = false;
}
if (ViewHelper.getY(mllWhere) == 25.0f && mEtWhere.isFocused() && mllWhereHasBeenClicked) {
Log.i(TAG, "mEtWho has the focus");
Log.i(TAG, "Back to oldllWhoYpos: " + oldllWhereYpos);
animate(mllWhere).setDuration(ANIM_DURATION).y(oldllWhereYpos);
mllWhereHasBeenClicked = false;
}
}