這是自定義的一種進度條,比如說下面那個分站數,可以通過設定 已開啟的分站數和總分站數
然後通過 已開啟的分站數 / 總分站數 × 100% = 已開啟的分站數所佔的百分比
上**:
-------------------------------halfcircleprogressview-------------------------------------
public class halfcircleprogressview extends view
@override
protected void onmeasure(int widthmeasurespec, int heightmeasurespec)
protected void ondraw(canvas canvas)
public halfcircleprogressview(context context)
public halfcircleprogressview(context context, attributeset attrs)
public void setprogress(int progress)
public void setvalue(int value)
----------------------在別的地方呼叫----------------------------
//請求到的資料
int ban4bzsum = msg.arg1;
int ban0bzsum = msg.arg2;
fzonetv.settext(ban4bzsum + "");
fztwotv.settext(ban0bzsum + "");
float ban4bzsum1 = ban4bzsum;
float ban0bzsum1 = ban0bzsum;
final float f1 = ban4bzsum1 / ban0bzsum1 * 100f;
final float f11 = 180f / ban0bzsum1 * ban4bzsum1;
//proone是初始化的控制項
proone.setvalue((int)f1);
proone.setprogress((int) f11);
-----------------------布局檔案---------------------
注釋:
Android自定義進度條
1.新建自定義view horizontalprogressbarwithprogress,2.自定義屬性 values目錄下新建attrs.xml檔案,定義各種屬性,並且給進度條引用 3.定義一些預設值和單位轉換方法 private static final int default text si...
Android之自定義進度條
進度條預設是不確定 indeterminate true android進度條 android進度條有4種風格可以使用。預設值是progressbarstyle。設定成progressbarstylesmall後,圖示變小。設定成progressbarstylelarge後,圖示變大 設定成prog...
Android自定義環形進度條
主頁面 author 有點涼了 public class mainactivity extends activity catch interruptedexception e start override public boolean oncreateoptionsmenu menu menu ov...