Android 抽屉式Activity
2012-07-17 14:06:29 来源:WEB开发网核心提示: @Override public void onAnimationEnd( Animation animation) {finish();overridePendingTransition(0, 0); }}); } public void open() {mCover.startAnimation(mStartAn
@Override
public void onAnimationEnd(
Animation animation) {
finish();
overridePendingTransition(
0, 0);
}
});
public void onAnimationEnd(
Animation animation) {
finish();
overridePendingTransition(
0, 0);
}
});
}
public void open() {
mCover.startAnimation(mStartAnimation);
}
mCover.startAnimation(mStartAnimation);
}
public void close() {
mCover.startAnimation(mStopAnimation);
}
mCover.startAnimation(mStopAnimation);
}
@Override
public boolean onKeyDown(
int keyCode, KeyEvent event) {
// 摁返回键时也要触发动画
if (keyCode == KeyEvent.KEYCODE_BACK) {
close();
return true;
}
return super.onKeyDown(keyCode,
event);
}
}
public boolean onKeyDown(
int keyCode, KeyEvent event) {
// 摁返回键时也要触发动画
if (keyCode == KeyEvent.KEYCODE_BACK) {
close();
return true;
}
return super.onKeyDown(keyCode,
event);
}
}
-----------------------项目.AVTIVITY
package slidre.co.cc;
import cn.mapplayer.engine.MiidiCredit;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class SliderActivity extends
Activity {
@Override
protected void onCreate(
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Activity {
@Override
protected void onCreate(
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample);
findViewById(R.id.sample_button)
.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(
View v) {
SettingActivity
.prepare(
SliderActivity.this,
R.id.inner_content);
startActivity(new Intent(
SliderActivity.this,
SettingActivity.class));
overridePendingTransition(
0,
0);
}
});
}
}
更多精彩
赞助商链接