0

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

The xml file:

<?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>

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

I've already removed the background border of the dialog

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

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.

mmBs
  • 8,421
  • 6
  • 38
  • 46
Omar HossamEldin
  • 3,033
  • 1
  • 25
  • 51

3 Answers3

2
android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent"

These two lines will do the trick.

mihirjoshi
  • 12,161
  • 7
  • 47
  • 78
0

Add this attributes to the ListView:

<android:listSelector = "@android:color/transparent"/>
<android:drawSelectorOnTop = "true"/>

Edit: With the previous attributes added to the ListView, then you can put a white background to the Relative Layout, by adding this to it:

<android:background = "@android:color/white"/>
Daniel Conde Marin
  • 7,588
  • 4
  • 35
  • 44
0

I was using AlertDialog instead of Dialog

Omar HossamEldin
  • 3,033
  • 1
  • 25
  • 51