-1

How to remove the title of the custome dialog.
And also remove its space.
Thankyou.
My layout

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top" >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="78dp"
    android:layout_marginTop="2dp"
    android:background="#00000000"
    android:gravity="top"
    android:text="Click to the button "
    android:textColor="#ffff00"
    android:textSize="15sp" />

</LinearLayout>

my code

 final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setTitle("Daialos");

    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.setContentView(R.layout.splash);
    dialog.setCancelable(true);
    dialog.show();

i am using
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); to avoid the title but its only avoid the text not the space.

sijo jose
  • 130
  • 9

2 Answers2

1

Why do you set a title for your dialog and you already want to remove the title? You should do something like this:

final Dialog dialog = new Dialog(this);
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.splash, null)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.setContentView(view);
dialog.show();
Hussein El Feky
  • 6,627
  • 5
  • 44
  • 57
0

remove line dialog.setTitle(). then it works fine.

Neeraj Sharma
  • 191
  • 18