i tùy chỉnh một hộp thoại:làm thế nào để loại bỏ khung hình chữ nhật của hộp thoại tùy chỉnh
public class CustomizeDialog extends Dialog implements OnClickListener {
Button close;
TextView tv;
public CustomizeDialog(Context context,String Stringcontent) {
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.custom_diolog_main);
tv=(TextView) findViewById(R.id.content);
tv.setText(Stringcontent);
close = (Button) findViewById(R.id.close);
close.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v == close)
dismiss();
}
}
xml là
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="100dip"
android:orientation="vertical"
android:background="@drawable/custom_diolog_bg"
android:layout_width="250dip">
<TextView android:layout_height="wrap_content"
android:textColor="#000"
android:textStyle="bold"
android:textSize="18sp"
android:id="@+id/content"
android:layout_marginLeft="15dip"
android:layout_marginTop="5dip"
android:layout_alignParentTop="true"
android:layout_width="250dip"
android:text=" Custom Dialog "/>
<Button android:layout_width="70dip"
android:layout_marginLeft="80dip"
android:background="@drawable/custom_dialog_button_bg"
android:layout_alignParentBottom="true"
android:layout_height="40dip" android:text="关闭"
android:id="@+id/close"></Button>
</RelativeLayout>
thoại của tôi là vrry tốt, nhưng custom_diolog_bg là một hình ảnh hình chữ nhật tròn, và khi tôi hiển thị hộp thoại của tôi, nó cho thấy một khung hệ thống cư xử tùy chỉnh của tôi, vì vậy tôi đã sử dụng this.getwindow.setBackgroundDrawable (null), sau đó hệ thống Frame có vẻ đã loại bỏ nhưng chỉ có bốn góc không loại bỏ, chúng tôi cũng thấy tối bốn góc, bởi vì tôi đã sử dụng hình ảnh hình chữ nhật được làm tròn.so câu hỏi của tôi về cách xóa tất cả Khung hình sao cho hộp thoại có vẻ rất tốt
hình ảnh là http://i.stack.imgur.com/EG7oz.jpg, vì vậy bạn có thể thấy có khung tối ở cuối cùng, cách xóa nó? cảm ơn bạn
nếu tôi sử dụng tính năng này, vị trí hiển thị hộp thoại letf -Up không ở giữa màn hình. – pengwang
Tôi đã cập nhật câu trả lời của mình có một cái nhìn tại đó – ingsaurabh
tôi đã sử dụng điều này, nhưng nó không thể hữu ích, cảm ơn bạn đã trả lời – pengwang