-2

I want to cut the white portion of the dialog form the following: Any help would be appreciated. Thanx in advance

https://i.stack.imgur.com/NPbiw.png

Neemani
  • 1
  • 4

3 Answers3

1

Create a xml in drawable , say dialog_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <solid
    android:color="@color/white"/>
<corners
    android:radius="30dp" />
<padding
    android:left="10dp"
    android:top="10dp"
    android:right="10dp"
    android:bottom="10dp" />
</shape>

set it as the background in your layout xml

android:background="@drawable/dialog_bg"

set the background of your dialog to transparent

dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

Or add this try:

 dialog.setStyle(DialogFragment.STYLE_NO_FRAME, 0);

Also you can set own style:

 /* theme is optional, I am using leanback... */
 setStyle(STYLE_NORMAL, R.style.AppTheme_Leanback);

Or:

<style name="Custom.Dialog" parent="android:Theme.DeviceDefault.Dialog.NoActionBar.MinWidth" >
      <item name="android:windowBackground">@null</item>
      <item name="android:windowIsFloating">true</item>
 </style>
azamatikus
  • 73
  • 6
1

use cardView has its has properties related to rounded corners and elevation

Chetan Ansel
  • 398
  • 2
  • 20
0

add it like this to your layout as background

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/rectangle"
     </LinearLayout>
</LinearLayout>