无法删除的Android Activity 边框?

标签 android android-activity margin

所以我有这个

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
    android:id="@+id/mainParent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bgdark"
    android:orientation="vertical" 
>
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="76dp"
        android:src="@drawable/myheader_250x60" 
    />
    <ListView
        android:id="@+id/mainListview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </ListView>
</LinearLayout>

注意 我现在已经编辑了这篇文章。我使用的是灰色背景图片,所以我认为这是标题图片右侧/左侧可见的内容。请参见下面的图片显示问题。

但是把背景移到listview上并没有解决问题。因此,似乎是 imageview 以某种方式具有灰色的左/右边框。因为我已将宽度设置为“match_parent”,所以它应该采用最大宽度。

enter image description here

问题是标题的顶部/右侧有灰色像素边框?如果可能的话,我想删除它。

最佳答案

尝试 scaleType attribute为您的 ImageView。

另一种方式——替换

android:src="@drawable/myheader_250x60" 

对于

android:background="@drawable/myheader_250x60" 

关于无法删除的Android Activity 边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15924345/

相关文章:

android - 如何判断应用程序是否在后台?

android - View 翻转器 : Receiver not registered

android - 我怎样才能找到从特定纬度和经度到周边地区的距离(以公里为单位)?

android - 使用Interface和直接传递Activity实现Callback的区别

html - 垂直 HTML 按钮间距问题

html - 为什么我不能以边距 : 0 auto? 为中心

html - Margin-Top < 0 会导致缩放错误

android - 在一个 Activity 中请求多个 RESTful 调用的最佳方法是什么

IntentService的onHandleIntent方法中的android.os.NetworkOnMainThreadException

android - 为什么在 android 中恢复 Activity 会导致 BadTokenException?