Android改变系统自带ProgressDialog的文字大小
16lz
2022-05-29
MainActivity如下:
package com.example.ttt;import android.app.Activity;import android.app.ProgressDialog;import android.os.Bundle;import android.view.Window;/** * Demo描述: * 改变系统自带ProgressDialog的文字大小 * * 改变方式: * 为ProgressDialog设置一个style即可 * 参见styles.xml * */public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //为此ProgressDialog指定style ProgressDialog dialog = new ProgressDialog(this,R.style.dialog); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("loading"); dialog.setCancelable(false); dialog.show(); } }
activity_main.xml如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:layout_centerHorizontal="true" />RelativeLayout>
styles.xml如下:
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppBaseTheme" parent="android:Theme.Light"> style> <style name="AppTheme" parent="AppBaseTheme"> style> <style name="dialog" parent="@android:style/Theme.Dialog">- @null
- true
- true
- true
- @android:color/transparent
- true
- @null
- 25sp
style>resources>
原文 http://blog.csdn.net/lfdfhl/article/details/11032535
更多相关文章
- Android(安卓)完全掌握Service
- Android虚拟键盘挡住输入框的处理方法
- android创建自定义对话框
- 2011.10.10(2)——— android Clipping关于剪切
- android 改变bitmap颜色
- Android延时执行的几种方法
- Android中使用AndroidTestCase的方法实例
- 如何查看ADT的版本号
- Android开发—弹出列表、单选、多选框