无法删除包含listView的相对布局的黑色背景 [英] Can't remove the black background of a relative layout contains a listView

查看:90
本文介绍了无法删除包含listView的相对布局的黑色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现一个自定义对话框,该对话框会扩展 RelativeLayout xml文件

I'm implementing a custom Dialog which inflates a RelativeLayout xml file

xml文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="300dp"
android:layout_height="match_parent"
android:gravity="center_horizontal" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitXY"
    android:src="@drawable/common_image_list_panel_transparent" />

<ListView
    android:id="@+id/teamListView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:layout_marginTop="65dp"
    android:cacheColorHint="#00000000"
    android:divider="@drawable/common_team_list_view_divider"
    android:dividerHeight="1dp"
    android:fadingEdge="none"
    android:scaleType="centerCrop" >
</ListView>

<ImageButton
    android:id="@+id/cancelTeamDialogButton"
    android:layout_width="25dp"
    android:layout_height="25dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_marginRight="14dp"
    android:layout_marginTop="15dp"
    android:background="@drawable/create_incident_screen_map_overlay_image_close"
    android:gravity="center"
    android:scaleType="fitXY" />

<TextView
    android:id="@+id/listTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="15dp"
    android:gravity="center_horizontal|fill_horizontal|center_vertical|fill_vertical"
    android:textSize="22sp" />

</RelativeLayout>

我试图更改 RelativeLayout ListView 的背景颜色,但没有任何反应.我总是得到这个

I tried to change the background color of the RelativeLayout and the ListView but nothing happens. I always get this

我已经删除了对话框的背景边框

I've already removed the background border of the dialog

dialog.getWindow().setBackgroundDrawable(
    new ColorDrawable(getResources().getColor(R.color.transparent)));

背景图像是带有框架的png,其余图像是透明的,我将 ListView 放置在框架内.我想要的是从背景中消除框架侧面和框架圆角外部存在的黑色.

The background image is a png with a frame and the rest is transparent and I positioned the ListView inside the frame. what i want is removing the black color from the background which present in side the frame and outside around the rounded corners of the frame.

推荐答案

我使用的是AlertDialog而不是Dialog

I was using AlertDialog instead of Dialog

这篇关于无法删除包含listView的相对布局的黑色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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