java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class
2016-02-22 12:18
816 查看
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class
异常解决方案:
是因为设置background的图片太大了,造成了内存溢出,在Activity设置onCreate里面加载布局的时候出错
不要设置跟布局的background为图片,可以用FrameLayout和ImageView实现相同的效果。
Option 1:
Create different perfect images for different dpi and place them in related drawable folder. Then set
android:background="@drawable/your_image
Option 2:
Add a single large image. Use FrameLayout. As a first child add an
ImageView. Set the following in your ImageView.
android:src="@drawable/your_image" android:scaleType = "centerCrop" 参考噢:http://stackoverflow.com/questions/16135984/full-screen-background-image-in-an-activity
相关文章推荐
- android studio创建代码库分上传到jcenter,使大家一行代码引用
- android开发launcher
- 有关android.view.View
- 详解android:scaleType属性
- Android编程之fill_parent、wrap_content和match_parent的区别
- android:layout_weight的真实含义
- Android开发之TimePicker控件用法实例详解
- 那两年炼就的Android内功修养
- Android中使用SDcard进行文件的读取
- Android实现广告图片轮播效果
- Android开发笔记之Intent初级学习教程
- android发送邮件
- Android开发懒人库 -- ButterKnife 用法
- Android实现手机震动效果
- Path2.0菜单-Android属性动画
- Android嵌入页面的碎片Fragment
- Android am 指令的使用
- Android 开发框架介绍
- Android中的Selector的用法
- 个人爱好的android开源库(持续更新中...)