解决scrollview嵌套ImageView时,出现除顶部和底部黑块的问题
2012-05-14 12:01
309 查看
最近一个项目中,从网上下载一个图片,然后展示给用户看,那个图片本来是iphone里的,拿到android上来,一拉伸就出问题了,scrollview的顶部和底部出现了奇怪的黑块,如图:
在网上找了很资料都没解决,后来在一个外国网站找到结果,分享一下。
代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="http://archive.cnblogs.com/a/2345498/@drawable/demo" rel="nofollow"/> android:adjustViewBounds="true"android:scaleType="centerInside"></ImageView>
</ScrollView>
</LinearLayout>
android:adjustViewBounds="true"这句很关键
在网上找了很资料都没解决,后来在一个外国网站找到结果,分享一下。
代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="http://archive.cnblogs.com/a/2345498/@drawable/demo" rel="nofollow"/> android:adjustViewBounds="true"android:scaleType="centerInside"></ImageView>
</ScrollView>
</LinearLayout>
android:adjustViewBounds="true"这句很关键
相关文章推荐
- 解决scrollview嵌套ImageView时,出现除顶部和底部黑块的问题[ 转载]
- 解决scrollview嵌套ImageView时,出现除顶部和底部黑块的问题
- 自定义对话框顶部两角出现黑线,底部正常,这个问题怎么解决?求大神赐教~~
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失,并解决activity跳转的时候出现短暂的黑屏
- 解决: 排列inline-block元素出现顶部不对齐的问题
- iOS中导航栏pop返回时出现黑块问题的解决方法
- 已解决:EditText被底部固定栏挡住,使用AndroidBug5497Workaround出现兼容问题
- android窗体动画:activity启动从底部向上滑动出现,关闭的时候从顶部向下滑动消失,并解决activity跳转的时候出现短暂的黑屏
- 隐藏TabBar后,UIWebView加载过程中和加载失败时,底部出现黑边的问题解决
- 解决透明NavigationBar底部出现莫名其妙横线问题
- 解决ScrollView嵌套listview出现进入页面不在顶部的问题
- 替换PopUpWindow(解决焦点获取问题)实现顶部筛选菜单(顶部不变,底部阴暗)
- 解决deepin-scrot在gnome3截图顶部出现黑边问题
- iOS 解决导航栏pop返回时出现黑块问题!
- 完美解决手机浏览器顶部下拉出现网页源或刷新的问题
- 解决手机浏览器顶部下拉出现网页源或刷新的问题
- 如何解决iphone手机微信浏览器中滑动到页面底部出现黑色背景盖住position:fixed的页面元素的问题?
- 解决透明NavigationBar底部出现莫名其妙横线问题
- 解决android 中在沉浸式布局下,EditText输入框在界面底部,在弹出输入法时将顶部标题栏向上推出界面问题
- 关于Android长按出现复制粘贴栏在顶部占位问题解决方法