我有一个动画两个的应用程序ImageViews
......我设法使用Menu
键来消失其中一个,ImageViews
因为它可以在不考虑软键盘的情况下使用。这是代码..
public class Client extends Activity {
private ImageView mScanner, mScanner2;
private Animation mAnimation;
private InputMethodManager mgr ;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mScanner = (ImageView)findViewById(R.id.imageView1);
mScanner2 = (ImageView) findViewById(R.id.imageView2);
mAnimation = new TranslateAnimation(0, 0, 0, 500);
mAnimation.setDuration(10000);
mAnimation.setFillAfter(true);
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.REVERSE);
mScanner2.setAnimation(mAnimation);
mScanner.setAnimation(mAnimation);
mScanner.setVisibility(View.VISIBLE);
mScanner2.setVisibility(View.VISIBLE);
EditText et = (EditText) findViewById(R.id.editText1);
mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInputFromInputMethod(et.getWindowToken(), 0);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch(keyCode){
case KeyEvent.KEYCODE_MENU:
System.out.println(" Menu Clicked");
mScanner.setAnimation(null);
mScanner.setVisibility(View.INVISIBLE);
return true;
case KeyEvent.KEYCODE_A:
System.out.println(" A ");
mScanner2.setAnimation(null);
mScanner2.setVisibility(View.INVISIBLE);
return true;
}
return true;
}
}
我希望键盘固定在屏幕底部。