導航:首頁 > 操作系統 > android圓形進度條

android圓形進度條

發布時間:2022-01-14 04:48:13

『壹』 android用非同步任務做一個簡單的圓形進度條載入該怎麼做 代碼求簡單清楚!

先上layout xml:

[html] view plain
<?xml version="1.0" encoding="UTF-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:interpolator="@android:anim/linear_interpolator" />
android:interpolator="@android:anim/linear_interpolator"這句話表示進度條動畫是勻速的。

再來定義一個CustomProgressDialog:

[html] view plain
public class CustomProgressDialog extends ProgressDialog{

public CustomProgressDialog(Context context) {
super(context);
}

public CustomProgressDialog(Context context, int theme) {
super(context, theme);
}

『貳』 android內部帶刻度的圓形進度條

78910111213
//circleCenter 整個圓半徑 radius圓環的半徑
RectF oval = new RectF(circleCenter - radius, circleCenter - radius, circleCenter + radius, circleCenter + radius);
//因為-90°才是從12點鍾方向開始 所以從-90開始 progress 為進度
canvas.drawArc(oval, -90, (float) (progress * 3.6), false, paint);

『叄』 Android 怎麼實現圓形水紋狀進度

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

『肆』 android自定義圓形進度條裡面怎麼寫文字

在你自定義View的onDraw()方法裡面使用canvas.drawText()方法

『伍』 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 類似進度圓環的是怎麼做的

方法:

這是一個自定義Android組件,用於代替標准進度條組件。實現各種進度條樣式,包括圓環,掃描等。
XML:
在你的attr.xml(res/value)中加入以下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

<declare-styleable name="ProgressWheel">
<attr name="text"format="string"/>
<attr name="textColor"format="color"/>
<attr name="textSize"format="dimension"/>
<attr name="barColor"format="color"/>
<attr name="rimColor"format="color"/>
<attr name="rimWidth"format="dimension"/>
<attr name="spinSpeed"format="integer"/>
<attr name="circleColor"format="color"/>
<attr name="radius"format="dimension"/>
<attr name="barWidth"format="dimension"/>
<attr name="barLength"format="dimension"/>
<attr name="delayMillis"format="dimension"/>
<attr name="contourColor"format="color"/>
<attr name="contourSize"format="float"/>
</declare-styleable>

在你的root view 中加入

1

xmlns:ProgressWheel="http://schemas.android.com/apk/res/com.visualdenim.schooltraq"

1

在你的xml合適的地方加入 組件

1
2
3
4
5
6
7
8
9
10
11
12
13

<com.todddavies.components.progressbar.ProgressWheel
android:id="@+id/pw_spinner"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerInParent="true"
ProgressWheel:text="Authenticating..."
ProgressWheel:textColor="#222"
ProgressWheel:textSize="14sp"
ProgressWheel:rimColor="#330097D6"
ProgressWheel:barLength="60dp"
ProgressWheel:barColor="#0097D6"
ProgressWheel:barWidth="5dp"
ProgressWheel:rimWidth="2dp"/>

Java:
你需要從layout中獲得進度條,或者初始化

1
2

ProgressWheel pw = newProgressWheel(myContext, myAttributes);
ProgressWheel pw = (ProgressWheel) findViewById(R.id.pw_spinner);

使用.spin() 開始進度條滾動, .stopSpinning 停止進度條滾動
增加進度有點棘手, 你可以調用.incrementProgress(), 但是這樣就超過了360度, 因為一個圓有360度, 你超過360度就會自動重置, 一個百分百自動分配

『柒』 android 圓形進度條 卡住

不太明白你的意思 你是說你在下載的時候顯示圓形進度條完成後顯示文本嗎 那就應該 把進度條去掉或者提示完成之後在顯示 文本啊 卡主了可能由於你沒有去掉進度條吧 希望對你有幫助

『捌』 android 圓形progressbar系統樣式有時候進度條沒有

Android中ProgressBar自定義進度條的高度、顏色、圓角
很多人知道怎麼改顏色,可是改高度就是胡扯了,居然想通過maxHeight去改。准確方法在這里:

下面這個改成了3-5個dp高度:

首先是樣式文件,這里定義高度:

『玖』 android 圓形進度條 中間怎麼寫 demo

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item android:id="@android:id/background">
<shape>
<corners android:radius="20dp" />

<gradient
android:angle="0"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:startColor="#ff9d9e9d" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="20dp" />

<gradient
android:angle="0"
android:centerColor="#80ffb600"
android:centerY="0.75"
android:endColor="#a0ffcb00"
android:startColor="#80ffd300" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="20dp" />

<gradient
android:angle="0"
android:endColor="#8000ff00"
android:startColor="#80ff0000" />
</shape>
</clip>
</item>
<!--
下面是標準的綠色進度條
<item
android:id="@android:id/background"
android:drawable="@drawable/security_progress_bg">
</item>
<item
android:id="@android:id/secondaryProgress"
android:drawable="@drawable/security_progress">
</item>
<item
android:id="@android:id/progress"
android:drawable="@drawable/security_progress">
</item>
-->

</layer-list>

『拾』 android自定義環形進度條怎麼自由控制進度條的消失與隱藏

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bluetoothmeter);
mhandler = new Handler();

//通過mSearcheHandler更新UI
mSearchHandler=new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==0){
//改變環形進度條的進度
mCircleProcessBar.setProgress(mcnt);
mcnt+=1;
if(MCNT_MAX<=mcnt){
mCircleProcessBar.setVisibility(View.GONE);
}
}
}
};
mBlueService = BluetoothLeService.getInstance();
initView();
initEvent();
}

private void initEvent()
{
mImgBtnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//搜索
mbtnSearch.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// Prepare list view and initiate scanning
if (m_devicelistadapter != null) {
m_devicelistadapter.clear();
m_devicelistadapter.notifyDataSetChanged();

}
startScan();

//設置圓環進度條的出現時間(秒)
new TimerDelay(mSearchHandler).setDelayTime(CIRCLE_APPARE_TIME,mCircleProcessBar);
mcnt=1;
}
});
}

閱讀全文

與android圓形進度條相關的資料

熱點內容
伺服器一直崩應該用什麼指令 瀏覽:916
cm202貼片機編程 瀏覽:723
php構造函數帶參數 瀏覽:174
解壓電波歌曲大全 瀏覽:336
為啥文件夾移到桌面成word了 瀏覽:858
命令符的安全模式是哪個鍵 瀏覽:758
編程中學 瀏覽:956
單片機求助 瀏覽:993
ug加工側面排銑毛坯怎麼編程 瀏覽:271
程序員有關的介紹 瀏覽:736
支付寶使用的什麼伺服器 瀏覽:210
安卓看本地書用什麼軟體好 瀏覽:921
經傳軟體滾動凈利潤指標源碼 瀏覽:522
螢石雲視頻已加密怎麼解除 瀏覽:574
一命令四要求五建議 瀏覽:30
qq文件夾遷移不了 瀏覽:19
液體粘滯系數測定不確定度演算法 瀏覽:332
輕棧源碼 瀏覽:426
把圖片壓縮到500k 瀏覽:35
命令你自己 瀏覽:369