样式添加到您的new Dialog()
构造如下图所示。
final Dialog dialog = new Dialog(main.this, R.style.DialogStyle);
dialog.setContentView(R.layout.prompt_dialoge);
dialog.setTitle("Draw your signature below");
Button dialogButton = (Button) dialog.findViewById(R.id.btnOk);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
}
});
dialog.show();
这种风格添加到您的styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="DialogStyle" parent="@android:style/Theme.Dialog">
<item name="android:windowAnimationStyle">@style/DialogAnimation</item>
</style>
<style name="DialogAnimation">
<item name="android:windowEnterAnimation">@anim/slide_in_right</item>
<item name="android:windowExitAnimation">@anim/slide_out_right</item>
</style>
</resources>
slide_in_right.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="200"
android:fillAfter="true"
android:fromXDelta="100%p"
android:interpolator="@android:anim/linear_interpolator"
android:toXDelta="00%p" />
</set>
slide_out_right.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="200"
android:fillAfter="true"
android:fromXDelta="000%p"
android:interpolator="@android:anim/linear_interpolator"
android:toXDelta="100%p" />
</set>
请添加与显示对话框相关的代码。 –
太容易了。每个人都知道如何打开对话框构建器。我只是想知道如何改变它被打开的方式。我想用刷卡方式打开生成器。而已。 – kamranbhatti585
我只想看看你的代码知道如何创建你的对话框,有很多方法来显示对话框。 –