我的应用程序中有一个对话框。当我点击忘记密码textview时,对话框打开。但布局顶部有一条水平线,同时给布局充气。我想删除那条水平线。下面是对话框的xml代码。
<?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" />
答案 0 :(得分:3)
您可以在setContentView()之前使用它删除水平线:
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.your_dialog);
答案 1 :(得分:1)
Dialog dialog = new Dialog(Main_Activity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.your_dialog);