Prateek Negi
Prateek Negi

Reputation: 97

Android dialog, remove horizontal line

I have a dialog in my application. when I am clicking on forget password textview, dialog open. but there is a horizontal line in the top of layout while inflating the layout. I want to remove that horizontal line. below is the xml code of dialog.

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

  <Space
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1.2" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="@dimen/text_size_button_s"
    android:layout_weight="1.2"
    android:background="@drawable/rounded_white_bg_popup"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/corner_radius_box_s"
        android:background="@color/coclor_whitw"
        android:orientation="vertical">

        <TextView
            android:id="@+id/tvMessage"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="@dimen/inner_img_m"
            android:layout_weight="1"
            android:gravity="center"
            android:singleLine="true"
            android:text="@string/Please_Enter_Your_Valid_Email"
            android:textColor="@color/cardview_dark_background"
            android:textSize="@dimen/text_size_button_m" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:background="@color/coclor_whitw"
            android:gravity="center"
            android:orientation="vertical">

            <EditText
                android:id="@+id/email"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/input_box"
                android:hint="@string/email"
                android:inputType="textEmailAddress"
                android:paddingLeft="@dimen/text_size_button_s"
                android:singleLine="true"
                android:textColor="#000000"
                android:textSize="@dimen/text_size_button_m" />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:background="@color/coclor_whitw"
            android:gravity="center"
            android:orientation="horizontal">

            <Space
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"/>

            <Button
                android:id="@+id/btnOk"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:background="@drawable/rounded_cornre_button"
                android:text="@string/okay"
                android:textColor="@color/color_yellow"
                android:textSize="@dimen/text_size_button_l"
                android:textStyle="bold" />

            <Space
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"/>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

<View
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1" />

Upvotes: 0

Views: 914

Answers (2)

VipiN Negi
VipiN Negi

Reputation: 3108

You can remove the horizontal line by using this just before setContentView() :

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
setContentView(R.layout.your_dialog);

Upvotes: 3

Mr_Moradi
Mr_Moradi

Reputation: 366

Dialog dialog = new Dialog(Main_Activity.this);    
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
setContentView(R.layout.your_dialog);

Upvotes: 2

Related Questions