當前位置:首頁 » 安卓系統 » 圓形進度條android

圓形進度條android

發布時間: 2023-03-07 04:48:00

① android 怎麼自定義繪制如下圖中這種進度條

下面是安卓學習手冊中實現各種進度條的截圖:

要想看各種進度條的實現代碼和文檔,直接去360手機助手中下載安卓學習手冊,例子文檔隨便看。

1、說明

在某些操作的進度中的可視指示器,為用戶呈現操作的進度,還它有一個次要的進度條,用來顯示中間進度,如在流媒體播放的緩沖區的進度。一個進度條也可不確定其進度。在不確定模式下,進度條顯示循環動畫。這種模式常用於應用程序使用任務的長度是未知的。

2、XML重要屬性

android:progressBarStyle:默認進度條樣式

android:progressBarStyleHorizontal:水平樣式

3 重要方法

getMax():返回這個進度條的范圍的上限

getProgress():返回進度

getSecondaryProgress():返回次要進度

incrementProgressBy(int diff):指定增加的進度

isIndeterminate():指示進度條是否在不確定模式下

setIndeterminate(boolean indeterminate):設置不確定模式下

setVisibility(int v):設置該進度條是否可視

4 重要事件

onSizeChanged(int w, int h, int oldw, int oldh):當進度值改變時引發此事件

5進度條的樣式

Widget.ProgressBar.Horizontal長形進度

Androidxml 布局:

<ProgressBar

android:id="@+id/progress_bar"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

style="@android:style/Widget.ProgressBar.Horizontal "

/>

源碼

private ProgressBar mProgress;

private int mProgressStatus=0;

private Handler mHandler=newHandler();

@Override

protected void onCreate(BundlesavedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

mProgress=(ProgressBar)findViewById(R.id.progress_bar);

new Thread(new Runnable(){

@Override

public void run(){

while(mProgressStatus<100){

mProgressStatus=doWork();

mHandler.post(new Runnable(){

@Override

public void run(){

mProgress.setProgress(mProgressStatus);

}

});

}

}

}).start();

}

效果圖:

帶第二進度的進度條

xml配置如下:

<ProgressBar

android:id="@+id/progress_bar_with_second"

style="@android:style/Widget.ProgressBar.Horizontal"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:progress="40"

android:secondaryProgress="70"

android:paddingTop="20dp"

android:paddingBottom="20dp"/>

這里我們設置了初始的進度為40,android:progress的值在mini和max之間即mini<=progressvalue<=max

設置了第二進度條的進度值為70,該值也在mini和max之間。

效果如下:

不確定模式進度條

xml配置文件:

<ProgressBar

android:id="@+id/progress_bar_indeterminate"

style="@android:style/Widget.ProgressBar.Horizontal"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:indeterminate="true"

android:indeterminateBehavior="cycle"

android:paddingBottom="20dp"

android:paddingTop="20dp"

android:progress="40" />

這里通過android:indeterminate="true"設置了當前為無模式進度條

效果如圖:

普通圓形進度:Widget.ProgressBar.Inverse

<ProgressBar

android:id="@+id/progress_bar1"

style="@android:style/Widget.ProgressBar.Inverse"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:progress="50"

android:background="#ff00ff"

android:paddingTop="4dp" />

通過android:backgroup設置了背景色

② android中怎麼讓圓形進度條動畫

首先解決問題一的問題: 你肯定使用了系統的 oncreateDialog 和 showdialog 方法了,所以 這個就會顯示一次 第二次不顯示了 , 你應該調用 dialog方法裡面的 show()方法 來顯示,這樣每次顯示那個progressbar都會在轉圈 問題二: 你說下面設置了一個白色背景,但是下面還是有個框,不過我有個疑問,如果你設置為白色背景,那麼你的轉條默認是白色的不就看不見了嗎?好了這個問題不糾結了!那個黑色的是邊框導致的,去掉邊框就行了 一般我們採用的是自定義dialog,也就是寫一個類來繼承dialog,這個時候的構造函數是這個: public MyDialog(Context context, int theme) { super(context, theme); this.context = context; init(); } 這個theme是什麼東西呢? 就是一個style樣式 如下: <resources>    <style name="dialog" parent="@android:style/Theme.Dialog">        <item name="android:windowFrame">@null</item><!--邊框--        <item name="android:windowIsFloating">true</item><!--是否浮現在activity之上--       <item name="android:windowIsTranslucent">false</item><!--半透明--        <item name="android:windowNoTitle">true</item><!--無標題--        <item name="android:windowBackground">@color/transparent</item><!--背景透明--        <item name="android:backgroundDimEnabled">false</item><!--模糊--    </style></resources>  其他代碼: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Dialog dialog = new MyDialog(this, R.style.MyDialog); android.view.WindowManager.LayoutParams pa3 = new android.view.WindowManager.LayoutParams(); pa3.height = android.view.WindowManager.LayoutParams.WRAP_CONTENT; pa3.width = android.view.WindowManager.LayoutParams.WRAP_CONTENT; pa3.x = 0;//x 起點 pa3.y = 0;//y起點 Window window = dialog.getWindow(); window.setAttributes(pa3); dialog.show(); return super.onKeyDown(keyCode, event); } 之所以android.view.WindowManager.LayoutParams我要這么寫,因為LayoutParams太多了,我害怕你找半天,兄弟對你夠好了吧! 要是選為精彩回答 那就謝謝你了!

③ Android 怎麼實現圓形水紋狀進度

CircleProgress:圓形進度條,可以實現仿 QQ 健康計步器的效果,支持配置進度條背景色、寬度、起始角度,支持進度條漸變
DialProgress:類似 CircleProgress,但是支持刻度
WaveProgress:實現了水波紋效果的圓形進度條,不支持漸變和起始角度配置,如需此功能可參考 CircleProgress 自行實現。
先上效果圖,有圖才好說。

④ Android 圓形進度條控制項

自定義控制項圓形進度條,支持頂部圓環漸變色,以及動畫功能.

res/vasues/attrs.xml

⑤ AndroidStudio編程,如何把圓形ProgressBar的中心位置和FloatingActionButton的中心位置進行綁定

FloatingActionButton(簡稱FAB)的使用方法非常的簡單
和一個普通控制項一樣,在xml布局文件中定義(記得導入Design包)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
src:設置FAB的圖標,google建議圖標的大小為24dp
backgroundTint:按鈕的默認顏色
borderWidth:設置為0dp,不然在4.1的SDK上會顯示方塊形,在5.x的系統上運行會沒有陰影
pressedTranslationZ:設置立體感,點擊時的陰影大小,默認是12dp
fabSize:設置FloatingActionButton的大小樣式,normal為正常大小(56dp),mini為小號的(40dp)
elevation:設置立體感,正常情況下陰影的大小,默認為6dp
rippleColor:點擊時的顏色,默認取theme中colorControlHighlight的顏色
FAB的點擊事件和普通View的點擊事件一樣,使用OnClickListener設置監聽
原生的FAB在體驗上並不友好,因為它遮擋住了要顯示的內容,尤其是在和ListView等控制項搭配時,如果頁面滾動到了最後,那麼遮住的部位就顯示不出來了。
解決方法:在頁面向下滑動的時候隱藏FAB,向上滑動時再顯示出來

⑥ Android 圓形進度條-跟360進度類似-時鍾刻度

話不多說 先上圖

實現原理:

1、先畫出中心進度問題

2、圓形進度灰色背景、圓形進度值帶光暈

3、時鍾刻度

github: https://github.com/hyyz3293/circlegearview.git

⑦ android 進度條樣式 怎麼改

Android系統提供了兩大類進度條樣式,長形進度條(progressBarStyleHorizontal) 和圓形進度條(progressBarStyleLarge)。

android 進度條樣式更改:

  • 第一種

    (默認樣式(中等圓形))

進度條用處很多,比如,應用程序裝載資源和網路連接時,可以提示用戶稍等,這一類進度條只是代表應用程序中某一部分的執行情況,而整個應用程序執行情況呢,則可以通過應用程序標題欄來顯示一個進度條,這就需要先對窗口的顯示風格進行設置"requestWindowFeature(Window.FEATURE_PROGRESS)"。

⑧ Android界面設計,下面圖的那個圓形進度條怎麼設計

這個你要自定義 Android 進度條。
自定義 progressbar 的樣式。

⑨ android progressbar 為什麼是圓的

繼承於View類,直接子類有AbsSeekBar和ContentLoadingProgressBar,其中AbsSeekBar的子類有SeekBar和RatingBar,可見這二者也是基於ProgressBar實現的。

1、ProgressBar有兩個進度,一個是android:progress,另一個是android:secondaryProgress。後者主要是為緩存需要所涉及的,比如在看網路視頻時候都會有一個緩存的進度條以及還要一個播放的進度,在這里緩存的進度就可以是android:secondaryProgress,而播放進度就是android:progress,有了secondProgress,可以很方便定製ProgressBar。

2、ProgressBar分為確定的和不確定的,確定的是我們能明確看到進度,相反不確定的就是不清楚、不確定一個操作需要多長時間來完成,這個時候就需要用的不確定的ProgressBar了。屬性android:indeterminate如果設置為true的話,那麼ProgressBar就可能是圓形的滾動條或者水平的滾動條(由樣式決定),但是我們一般時候,是直接使用Style類型來區分圓形還是水平ProgressBar的。
3、ProgressBar的樣式設定其實有兩種方式,在API文檔中說明的方式如下:

Widget.ProgressBar.Horizontal
Widget.ProgressBar.Small
Widget.ProgressBar.Large
Widget.ProgressBar.Inverse
Widget.ProgressBar.Small.Inverse
Widget.ProgressBar.Large.Inverse
使用的時候可以這樣:style="@android:style/Widget.ProgressBar.Small",另外還有一種方式就是使用系統的attr,下面的方式是系統的style:

style="?android:attr/progressBarStyle"
style="?android:attr/progressBarStyleHorizontal"
style="?android:attr/progressBarStyleInverse"
style="?android:attr/progressBarStyleLarge"
style="?android:attr/progressBarStyleLargeInverse"
style="?android:attr/progressBarStyleSmall"
style="?android:attr/progressBarStyleSmallInverse"
style="?android:attr/progressBarStyleSmallTitle"
[java] view plain
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
style="@android:style/Widget.ProgressBar.Horizontal"(等同於@android:attr)
android:layout_width="match_parent"
android:layout_height="wrap_content" />

⑩ 如何正確地使用android中的progressdialog-Android

// 方式一:new Dialog
final ProgressDialog dialog = new ProgressDialog(this);
dialog.show();

// 方式二:使用靜態方式創建並顯示,這種進度條只能是圓形條,設置title和Message提示內容
ProgressDialog dialog2 = ProgressDialog.show(this, "提示", "正在登陸中");

// 方式三 使用靜態方式創建並顯示,這種進度條只能是圓形條,這里最後一個參數boolean indeterminate設置是否是不明確的狀態
ProgressDialog dialog3 = ProgressDialog
.show(this, "提示", "正在登陸中", false);

// 方式四 使用靜態方式創建並顯示,這種進度條只能是圓形條,這里最後一個參數boolean cancelable 設置是否進度條是可以取消的
ProgressDialog dialog4 = ProgressDialog.show(this, "提示", "正在登陸中",
false, true);

// 方式五 使用靜態方式創建並顯示,這種進度條只能是圓形條,這里最後一個參數 DialogInterface.OnCancelListener
// cancelListener用於監聽進度條被取消
ProgressDialog dialog5 = ProgressDialog.show(this, "提示", "正在登陸中", true,
true, cancelListener);

熱點內容
廣東人社賬號密碼多少 發布:2025-05-10 03:43:11 瀏覽:616
python對象參數 發布:2025-05-10 03:43:11 瀏覽:575
自己伺服器搭建梯子 發布:2025-05-10 03:31:39 瀏覽:573
華為升級包怎麼解壓 發布:2025-05-10 03:18:24 瀏覽:603
c語言以什麼結束 發布:2025-05-10 03:18:22 瀏覽:257
160android 發布:2025-05-10 03:03:30 瀏覽:178
pythonstorage 發布:2025-05-10 02:58:38 瀏覽:499
如何查看電腦配置顯卡參數 發布:2025-05-10 02:37:00 瀏覽:106
證券交易密碼在哪裡修改 發布:2025-05-10 02:31:56 瀏覽:839
javafor是什麼意思 發布:2025-05-10 02:23:09 瀏覽:842