zoukankan      html  css  js  c++  java
  • Android改变系统自带环形ProgressBar的大小

    MainActivity如下:

    package cc.testprogressbar;
    
    import android.os.Bundle;
    import android.app.Activity;
    /**
     * Demo描述:
     * 改变系统自带环形ProgressBar的大小
     * 
     * 改变方式:
     * 为ProgressBar设置一个style即可
     * 参见styles.xml
     *
     */
    public class MainActivity extends Activity {
    
    	@Override
    	protected void onCreate(Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.main);
    	}
    }
    


     

    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="改变系统自带ProgressBar的大小"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="100dip"
            />
        
        <ProgressBar 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            style="@style/testProgressBarStyle"
            />
    
    </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="testProgressBarStyle" parent="@android:style/Widget.ProgressBar.Large">
            <item name="android:minHeight">50dip</item>
            <item name="android:minWidth">50dip</item>
            <item name="android:maxHeight">50dip</item>
            <item name="android:maxWidth">50dip</item>
        </style>
    
    </resources>


     

  • 相关阅读:
    异常处理、网络编程
    内置函数、反射、__str__、__del__、元类
    tomcat 拒绝服务
    html标签
    google 与服务器搭建
    liunx centox ssh 配置
    java 泛型
    Windows Mysql安装
    java 空对象
    java 动态代理(类型信息)
  • 原文地址:https://www.cnblogs.com/pangblog/p/3310538.html
Copyright © 2011-2022 走看看