ITeye博客

android 问题汇总

jguangyou · 2012-02-27 17:18 · android · 移动开发 · Markdown

刚开始学习Android开发,遇到不少问题,也走了不少弯路。现做个汇总,方便自己查阅,如果您也有相似问题,也可以查阅。 1、MAC下模拟器中横屏、竖屏的切换快捷键(FN+CTRL+F11)这个找了好久,费了不少劲 2、MAC下申请GoogleMAP API key 命令行:keytool -list -keystore ~/.android/debug.keystore 3、横屏、竖屏切换时禁止重新新建一个Activity (1)XML中: (2)代码中:重写方法 public void onConfigurationChanged(Configuration config) { super.onConfigurationChanged(config); TextView spaceBanner = (TextView) findViewById(R.id.topBanner3); Display display = this.getWindowManager().getDefaultDisplay(); int height = display.getHeight(); int width = display.getWidth(); if (width > height) {// 横屏 spaceBanner.getLayoutParams().width = 3 * display.getWidth() } else {// 竖屏 spaceBanner.getLayoutParams().width = 2 * display.getWidth() / 5;' } 4、Activity切换时增加动画效果 bundle = new Bundle(); intent = new Intent(); intent.setClass(_this,MapActivity.class); intent.putExtras(bundle); startActivity(intent); overridePendingTransition(R.anim.zoomin,R.anim.zoomout);//起作用的代码 5、设置全屏幕* getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); 6、Tab页面切换时,重新刷新Activity //This tab sets the intent flag so that it is recreated each time the tab is clicked. tabHost.addTab(tabHost.newTabSpec("tab3") .setIndicator("destroy") .setContent(new Intent(this, SecondTab.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));//起作用的代码

7、强制刷新View的内容 调用view的invalidate()方法

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。