@Override protected void initView(Bundle savedInstanceState) { listView = (ListView) findViewById(R.id.listView); List<String> list = new ArrayList<String>(); for (int i = 0; i < 20; i++) { list.add("数据" + i); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list); listView.setAdapter(adapter); LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.zoom_in)); lac.setOrder(LayoutAnimationController.ORDER_NORMAL); listView.setLayoutAnimation(lac); listView.startLayoutAnimation(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); extras = getIntent().getExtras(); if (extras != null) { try { LayoutInflater factory = LayoutInflater.from(LoginActivity.this); final RelativeLayout layout = (RelativeLayout) factory.inflate(R.layout.login, null); String animation = extras.getString("animation"); // 得到一个LayoutAnimationController对象; if (animation.equals("left")) { controller = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_left_in); } else { controller = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_right_in); } // 设置控件显示的顺序; controller.setOrder(LayoutAnimationController.ORDER_REVERSE); // 设置控件显示间隔时间; controller.setDelay(0); // 为ListView设置LayoutAnimationController属性; layout.setLayoutAnimation(controller); setContentView(layout); } catch (Exception e) { // TODO: handle exception setContentView(R.layout.login); String id = extras.getString("id"); String pwd = extras.getString("pwd"); System.out.println(id); System.out.println(pwd); login(id, pwd); } } else { setContentView(R.layout.login); } mGestureDetector = new GestureDetector(this, (OnGestureListener) this); _id = (EditText) findViewById(R.id.id_edit); _pwd = (EditText) findViewById(R.id.pwd_edit); final Button _backButton = (Button) findViewById(R.id.back_button); final Button _loginButton = (Button) findViewById(R.id.login_button); final Button _forgetButton = (Button) findViewById(R.id.forget_button); final Button _show_hide_Button = (Button) findViewById(R.id.show_hide_button); // final ProgressBar bar = (ProgressBar) findViewById(R.id.login_pb); _backButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(LoginActivity.this, EnterActivity.class); startActivity(intent); LoginActivity.this.finish(); } }); _loginButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub System.out.println("Python: " + _id.getText().toString()); System.out.println("FWL: " + _pwd.getText().toString()); login(_id.getText().toString(), _pwd.getText().toString()); } }); _forgetButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(LoginActivity.this, ForgetPwdActivity.class); startActivity(intent); LoginActivity.this.finish(); } }); _show_hide_Button.setOnTouchListener( new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if (event.getAction() == MotionEvent.ACTION_DOWN) { if (0 == showorhide) { _pwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); _show_hide_Button.setText(getString(R.string._hidepwd)); showorhide = 1; } else { _pwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); _show_hide_Button.setText(getString(R.string._showpwd)); showorhide = 0; } } else { // do nothing } return false; } }); /* _showpwdButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (((CheckBox) v).isChecked()) { System.out.println("Checked"); _pwd.setTransformationMethod(HideReturnsTransformationMethod .getInstance()); } else { System.out.println("Not Checked"); _pwd.setTransformationMethod(PasswordTransformationMethod .getInstance()); } } }); */ }