zoukankan      html  css  js  c++  java
  • ProgressDialog(四)——更改系统自带ProgressDialog文字大小

    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">
            <item name="android:windowFrame">@null</item>
            <item name="android:windowIsFloating">true</item>
            <item name="android:windowIsTranslucent">true</item>
            <item name="android:windowNoTitle">true</item>
            <item name="android:windowBackground">@android:color/transparent</item>
            <item name="android:backgroundDimEnabled">true</item>
            <item name="android:windowContentOverlay">@null</item>
            <item name="android:textSize">25sp</item>
        </style>
    
    </resources>


    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    github新手使用指南
    Nacos(五):多环境下如何“读取”Nacos中相应的配置
    Nacos(四):SpringCloud项目中接入Nacos作为配置中心
    Nacos:Nacos与OpenFeign的对接使用
    解决IDEA的maven项目 添加依赖后Reimport无反应
    SpringCloud项目中接入Nacos作为注册中心
    Nacos 使用
    SpringCloud教程 | 第十三篇: 断路器聚合监控(Hystrix Turbine)
    C# Task总结(Action,Func,委托)
    C# Task总结(异步操作+并行)
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/4726153.html
Copyright © 2011-2022 走看看