现在的位置: 首页 > 综合 > 正文

android开发搜集

2013年08月16日 ⁄ 综合 ⁄ 共 1575字 ⁄ 字号 评论关闭

1、自适应各种尺寸的图片配置:http://blog.csdn.net/luoyuhhy/article/details/6451901

搜索关键字:android 图片 自适应 分辨率

2、对话框:http://www.cnblogs.com/salam/archive/2010/11/15/1877512.html

3、相册、相机图片处理:http://my.oschina.net/onlytwo/blog/71192

4、[Android实例] ListView嵌套GridView(GridView实现横向滑动) 

资源地址:http://download.csdn.net/detail/wyyl1/5121975

5、传递对象

list是可序列化对象

传值:

Intent mIntent = new Intent(mContext, ChexiActivity.class);
CarBrand cb = gcb.getFlList().get(position);
Bundle mBundle = new Bundle();
mBundle.putSerializable("carBrandList", list);
mIntent.putExtras(mBundle);

mContext.startActivity(mIntent);

取值:

list = (ArrayList<CarBrands>)getIntent().getSerializableExtra("carBrandList");

6、android.support.v4.view.PagerAdapter获得当前页

pageradapter get current page

mViewPager.getCurrentItem()

资源地址:http://stackoverflow.com/questions/8538035/android-pageradapter-get-current-position

7、android退出应用代码

android.os.Process.killProcess(android.os.Process.myPid());

带对话框的代码:

new AlertDialog.Builder(this).setTitle("退出").setMessage("确定吗?")
.setPositiveButton("是", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
android.os.Process.killProcess(android.os.Process.myPid());
}
}).setNegativeButton("否", null).show();

8、android-support-v4.jar源码关联

移除 Android Dependencies 
在libs下 右键 android-support-v4.jar  Build Path ->Add To Build Path
重新选择android的版本可以重新生成Android Dependencies

资源地址:http://www.cnblogs.com/hanleytowne/archive/2013/01/24/android-support-v4.html

9、禁止 activity 睡眠、Android中设置禁止休眠

getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

资源地址:http://abc20899.iteye.com/blog/1045537

抱歉!评论已关闭.