上述ImageView的空场地 [英] Empty space above ImageView

查看:146
本文介绍了上述ImageView的空场地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListView以上的静态ImageView的。
但ImageView的正显示出它上面的一些空白。

我怎样才能删除此空?

- 当我使用的图像作为一个TextView的背景及其在母公司顶神韵完美

下面是我的XML的ImageView的:

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:背景=@机器人:彩色/ background_light
> < ImageView的
        机器人:ID =@ + ID / titlebartear
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_alignParentTop =真
        机器人:layout_marginTop = - 5dip
        机器人:SRC =@绘制/ titlebartear
        /> < ListView的机器人:ID =@机器人:ID /列表
    机器人:paddingTop =0像素
    机器人:标签=fileslist
    机器人:fastScrollEnabled =真
    机器人:smoothScrollbar =真
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:分=@彩色/ pijndagboek_light_blue
    机器人:dividerHeight =2px的
    机器人:cacheColorHint =#00000000
    机器人:layout_below =@ ID / titlebartear
    />< / RelativeLayout的>


解决方案

一个有点晚,但可以帮助他人跨越这个stubmle:

调整ViewBounds为我工作,当绘制自动调整它的设置视图的高度。

(在空的空间的上方和下方的图像本身所得)

I got a static ImageView above a listView. But the imageView is showing some empty space above it.

How can i remove this empty space?

-when i use the the image as background of a TextView its perfectly alligned at parent top

Here is my xml for the ImageView:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:background="@android:color/background_light"
>

 <ImageView
        android:id="@+id/titlebartear"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginTop="-5dip"
        android:src="@drawable/titlebartear"
        />

 <ListView android:id="@android:id/list" 
    android:paddingTop="0px" 
    android:tag="fileslist"
    android:fastScrollEnabled="true"
    android:smoothScrollbar="true"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:divider="@color/pijndagboek_light_blue"
    android:dividerHeight="2px"
    android:cacheColorHint="#00000000"
    android:layout_below="@id/titlebartear"
    />

</RelativeLayout>

解决方案

A bit late, but may help others that stubmle across this:

"Adjust ViewBounds" worked for me, when a drawable automatically scales the height of the View it's set to. (Resulting in empty space above and below the image itself)

这篇关于上述ImageView的空场地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆