简体   繁体   中英

Move view to the top of the screen with animation

I have following layout:

布局

Three EditText s in LinearLayout with layout_width = 0.33 . When user put focus to one of those EditText s, two other should dissapear (maybe animation too) and last one should be moved to the top of the screen with some animation meanwhile soft keyboard is shown. Result should looke like this:

结果

Solution without animation is simple:

if(focusedView == mBlueEdit) {
  mRedEdit.setVisibility(View.GONE);
  mGreenEdit.setVisibility(View.GONE);

I can't figure out, when to start (it's too late start it after GONE is set at other views) and how to compute X and Y positions at start and at the end of animation. Thanks in advance for every hint.

不确定是否要查找它,但是可以通过将android:animateLayoutChanges="true"到LinearLayout中来创建自动动画。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM