b![](https://img-my.csdn.net/uploads/201211/08/1352341256_8709.jpg)
uilder = new Dialog(MainActivity.this, R.style.dialog);
builder.setContentView(R.layout.play_dialog1);
TextView textView = (TextView) builder
.findViewById(R.id.dialog_edittext);
textView.setText(type);
Button button = (Button) builder.findViewById(R.id.custom_button_ok);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
builder.dismiss();
}
});
Button button1 = (Button) builder
.findViewById(R.id.custom_button_cancl);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
builder.dismiss();
}
});
builder.show();
<style name="dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="530dp"
android:layout_height="wrap_content"
android:background="@drawable/dialog_bg"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dip"
android:orientation="horizontal" >
<TextView
android:id="@+id/dialog_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textSize="25sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dip"
android:orientation="horizontal" >
<Button
android:id="@+id/custom_button_ok"
android:layout_width="170dip"
android:layout_height="70dip"
android:background="@drawable/move_sort_word_bg"
android:text="@string/button_ok"
android:textColor="#ffffff"
android:textSize="30sp" />
<Button
android:id="@+id/custom_button_cancl"
android:layout_width="170dip"
android:layout_height="70dip"
android:layout_marginLeft="20dp"
android:background="@drawable/move_sort_word_bg"
android:text="@string/button_cancl"
android:textColor="#ffffff"
android:textSize="30sp" />
</LinearLayout>
<!-- android:background="@drawable/botton" -->
</LinearLayout>