您的位置:首页 > 移动开发 > Android开发

android 零碎知识点

2012-08-10 17:54 316 查看
一:设置全屏
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);super.onCreate(savedInstanceState);//放在这个之前
二:读取SD卡上的图片设为某空间的背景
1:判断是否有SD卡public static boolean isHaveSDCard(){String state = Environment.getExternalStorageState();if(Environment.MEDIA_MOUNTED.equals(state) ||Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)){isHaveSdCard = true;}return false;}
2:读取SD卡某个图片public Drawable setTitleBackgroundFilter(String picName){BitmapDrawable bd = null ;if(WelcomePage.isHaveSdCard){String DrawableSDPath = configUrl.webUiPngPath_sdcard+picName+version+".png"; //configUrl.webUiPngPath_sdcard 是SD路径bd = new BitmapDrawable(DrawableSDPath);if(bd != null){return bd;}else{String DrawableMemoryPath = configUrl.webUiPngPath_memory + picName + version + ".png"; //configUrl.webUiPngPath_memory 内存路径bd = new BitmapDrawable(DrawableMemoryPath);return bd;}}return null;}
3:将读取出来的图片设置为相应控件背景,这里是设置为title layout的背景,也可以是各种图片setContentView(R.layout.froad_main);getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.froad_title);linearLayoutTitle = (LinearLayout)findViewById(R.id.froad_title_title);Drawable sld_title = setTitleBackgroundFilter(ResName.titlePng);if(null != sld_title){linearLayoutTitle.setBackgroundDrawable(sld_title);}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: