baigujing

在values 文件夹下面创建.style.xml文件

 

<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

<style name="MyDialog" parent="@android:style/Theme.Dialog">//继承已经有的对话框
<item name="android:windowBackground">@drawable/title_background</item>//使用背景图
<item name="android:windowNoTitle">true</item>//没有titile
</style>

</resources>

 

在java中使用对话框:

private Dialog dialog;

dialog = new Dialog(this, R.style.MyDialog);
View view = View.inflate(this, R.layout.first_entry_dialog, null);
et_pwd = (EditText) view.findViewById(R.id.et_first_entry_pwd);//给自定义对话框打气球
et_pwd_confirm = (EditText) view.findViewById(R.id.et_first_entry_pwd_confirm);
Button bt_ok = (Button) view.findViewById(R.id.bt_first_dialog_ok);
Button bt_cancle = (Button) view.findViewById(R.id.bt_first_dialog_cancle);
bt_ok.setOnClickListener(this);
bt_cancle.setOnClickListener(this);
dialog.setContentView(view);
dialog.show();

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-13
  • 2021-10-05
  • 2021-12-09
  • 2022-01-29
  • 2021-09-21
  • 2022-12-23
猜你喜欢
  • 2021-05-14
  • 2021-11-06
  • 2021-10-09
  • 2022-12-23
  • 2021-07-09
  • 2021-11-14
相关资源
相似解决方案