android:background 图片被拉伸解决方法
2016-07-12 21:04
531 查看
使用图片给Linerlayout等做背景的时候图片会被不同程度拉伸
我们可以在xml设置android:background属性时,使用标签
drawable/bg.xml
android:gravity可以自行调整以适应显示效果
这样图片就不会被拉伸了
<LinearLayout android:layout_width="match_parent" android:background="@drawable/bg" android:layout_height="match_parent"/>
我们可以在xml设置android:background属性时,使用标签
drawable/bg.xml
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="bottom" android:dither="true" android:src="@mipmap/login_background" android:tileMode="disabled"/>
android:gravity可以自行调整以适应显示效果
这样图片就不会被拉伸了
相关文章推荐
- Android文件的权限概念
- 为什么Android AsyncTask的使用要遵循五大原则
- Android绘图机制与处理技巧
- Android JNI 入门
- Android开源项目分类汇总
- Gradle编译打包小结
- Android 存储到SD卡,获取SD的大小及可用空间
- Android开发代码格式规范
- Android单元测试
- <Android>彻底去掉导航栏方法
- [Android Tips] 21. Regex Named Groups in Android
- Android中Scheme跳转协议
- Android高性能开发规范探索 一
- Android 在布局中用代码随意添加视图
- android中handler用法总结
- Android复选框之鱼和熊掌可兼得CheckBox
- 报错】android.util.AndroidRuntimeException: You cannot combine custom titles with other title features.
- Android Studio官方文档之使用Image Asset Studio添加位图图像
- (4.2.32.5)android热修复之Andfix方式:Andfix的补丁生成方法分析
- 解决Android Studio配置JPush极光推送错误方案