【问题标题】:How do I get rid of this weird white background on my list view如何摆脱列表视图中这个奇怪的白色背景
【发布时间】:2018-06-24 20:36:05
【问题描述】:

我正在尝试制作我的 iOS 应用程序的 Android 版本,但我的列表视图和列表视图中的图像周围出现了这个奇怪的白色边框,这非常令人沮丧。截图如下:

这是我的文件代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.leoconnelly.connexus.HealthCenterListActivity">

android:background="#D53D96"

<ListView
    android:id="@+id/hospitals_list_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="8dp"
    android:background="#D53D96"

    />
</RelativeLayout>

【问题讨论】:

  • 移除 android:layout_margin="8dp"

标签: android android-studio user-interface


【解决方案1】:

您可以从ListView 中删除android:layout_margin="8dp" 或将相同的背景放入它的父级:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#D53D96"
tools:context="com.example.leoconnelly.connexus.HealthCenterListActivity">



<ListView
    android:id="@+id/hospitals_list_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="8dp"
    android:background="#D53D96"

    />
</RelativeLayout>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-18
    • 2013-01-06
    • 2021-09-04
    • 2018-02-13
    • 1970-01-01
    相关资源
    最近更新 更多