ProgressBar进度条Word文档格式.docx

上传人:b****7 文档编号:22238249 上传时间:2023-02-03 格式:DOCX 页数:30 大小:23.72KB
下载 相关 举报
ProgressBar进度条Word文档格式.docx_第1页
第1页 / 共30页
ProgressBar进度条Word文档格式.docx_第2页
第2页 / 共30页
ProgressBar进度条Word文档格式.docx_第3页
第3页 / 共30页
ProgressBar进度条Word文档格式.docx_第4页
第4页 / 共30页
ProgressBar进度条Word文档格式.docx_第5页
第5页 / 共30页
点击查看更多>>
下载资源
资源描述

ProgressBar进度条Word文档格式.docx

《ProgressBar进度条Word文档格式.docx》由会员分享,可在线阅读,更多相关《ProgressBar进度条Word文档格式.docx(30页珍藏版)》请在冰豆网上搜索。

ProgressBar进度条Word文档格式.docx

privateintmProgressStatus=0;

privateHandlermHandler=newHandler();

protectedvoidonCreate(Bundleicicle){

super.onCreate(icicle);

setContentView(R.layout.progressbar_activity);

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

//Startlengthyoperationinabackgroundthread

newThread(newRunnable(){

publicvoidrun(){

while(mProgressStatus<

100){

mProgressStatus=doWork();

//Updatetheprogressbar

mHandler.post(newRunnable(){

mProgress.setProgress(mProgressStatus);

}

});

}).start();

Toaddaprogressbartoalayoutfile,youcanusethe<

ProgressBar>

element.Bydefault,theprogressbarisaspinningwheel(anindeterminateindicator).Tochangetoahorizontalprogressbar,applytheWidget.ProgressBar.Horizontalstyle,likeso:

<

ProgressBar

style="

@android:

style/Widget.ProgressBar.Horizontal"

.../>

Ifyouwillusetheprogressbartoshowrealprogress,youmustusethehorizontalbar.YoucanthenincrementtheprogresswithincrementProgressBy()orsetProgress().Bydefault,theprogressbarisfullwhenitreaches100.Ifnecessary,youcanadjustthemaximumvalue(thevalueforafullbar)usingtheandroid:

maxattribute.Otherattributesavailablearelistedbelow.

AnothercommonstyletoapplytotheprogressbarisWidget.ProgressBar.Small,whichshowsasmallerversionofthespinningwheel—usefulwhenwaitingforcontenttoload.Forexample,youcaninsertthiskindofprogressbarintoyourdefaultlayoutforaviewthatwillbepopulatedbysomecontentfetchedfromtheInternet—thespinningwheelappearsimmediatelyandwhenyourapplicationreceivesthecontent,itreplacestheprogressbarwiththeloadedcontent.Forexample:

LinearLayout

android:

orientation="

horizontal"

...>

layout_width="

wrap_content"

layout_height="

style/Widget.ProgressBar.Small"

layout_marginRight="

5dp"

/>

TextView

text="

@string/loading"

/LinearLayout>

Otherprogressbarstylesprovidedbythesysteminclude:

Widget.ProgressBar.Horizontal

Widget.ProgressBar.Small

Widget.ProgressBar.Large

Widget.ProgressBar.Inverse

Widget.ProgressBar.Small.Inverse

Widget.ProgressBar.Large.Inverse

The"

inverse"

stylesprovideaninversecolorschemeforthespinner,whichmaybenecessaryifyourapplicationusesalightcoloredtheme(awhitebackground).

XMLattributes

SeeProgressBarAttributes,ViewAttributes

Summary

XMLAttributes

AttributeNameRelatedMethodDescription

android:

animationResolutionTimeoutbetweenframesofanimationinmilliseconds

Mustbeanintegervalue,suchas"

100"

.

indeterminateAllowstoenabletheindeterminatemode.

indeterminateBehaviorDefineshowtheindeterminatemodeshouldbehavewhentheprogressreachesmax.

indeterminateDrawableDrawableusedfortheindeterminatemode.

indeterminateDurationDurationoftheindeterminateanimation.

indeterminateOnlyRestrictstoONLYindeterminatemode(state-keepingprogressmodewillnotwork).

indeterminateTintsetIndeterminateTintList(ColorStateList)Tinttoapplytotheindeterminateprogressindicator.

indeterminateTintModesetIndeterminateTintMode(PorterDuff.Mode)Blendingmodeusedtoapplytheindeterminateprogressindicatortint.

interpolator

maxDefinesthemaximumvaluetheprogresscantake.

maxHeightAnoptionalargumenttosupplyamaximumheightforthisview.

maxWidthAnoptionalargumenttosupplyamaximumwidthforthisview.

minHeight

minWidth

mirrorForRtlDefinesiftheassociateddrawablesneedtobemirroredwheninRTLmode.

progressDefinesthedefaultprogressvalue,between0andmax.

progressBackgroundTintsetProgressBackgroundTintList(ColorStateList)Tinttoapplytotheprogressindicatorbackground.

progressBackgroundTintModesetProgressBackgroundTintMode(PorterDuff.Mode)Blendingmodeusedtoapplytheprogressindicatorbackgroundtint.

progressDrawableDrawableusedfortheprogressmode.

progressTintsetProgressTintList(ColorStateList)Tinttoapplytotheprogressindicator.

progressTintModesetProgressTintMode(PorterDuff.Mode)Blendingmodeusedtoapplytheprogressindicatortint.

secondaryProgressDefinesthesecondaryprogressvalue,between0andmax.

secondaryProgressTintsetSecondaryProgressTintList(ColorStateList)Tinttoapplytothesecondaryprogressindicator.

secondaryProgressTintModesetSecondaryProgressTintMode(PorterDuff.Mode)Blendingmodeusedtoapplythesecondaryprogressindicatortint.

[Expand]

InheritedXMLAttributes

Fromclassandroid.view.View

InheritedConstants

InheritedFields

PublicConstructors

ProgressBar(Contextcontext)

Createanewprogressbarwithrange0...100andinitialprogressof0.

ProgressBar(Contextcontext,AttributeSetattrs)

ProgressBar(Contextcontext,AttributeSetattrs,intdefStyleAttr)

ProgressBar(Contextcontext,AttributeSetattrs,intdefStyleAttr,intdefStyleRes)

PublicMethods

voiddrawableHotspotChanged(floatx,floaty)

Thisfunctioniscalledwhenevertheviewhotspotchangesandneedstobepropagatedtodrawablesorchildviewsmanagedbytheview.

CharSequencegetAccessibilityClassName()

Returntheclassnameofthisobjecttobeusedforaccessibilitypurposes.

DrawablegetIndeterminateDrawable()

Getthedrawableusedtodrawtheprogressbarinindeterminatemode.

ColorStateListgetIndeterminateTintList()

PorterDuff.ModegetIndeterminateTintMode()

Returnstheblendingmodeusedtoapplythetinttotheindeterminatedrawable,ifspecified.

InterpolatorgetInterpolator()

Getstheaccelerationcurvetypefortheindeterminateanimation.

synchronizedintgetMax()

Returntheupperlimitofthisprogressbar'

srange.

synchronizedintgetProgress()

Gettheprogressbar'

scurrentlevelofprogress.

ColorStateListgetProgressBackgroundTintList()

Returnsthetintappliedtotheprogressbackground,ifspecified.

PorterDuff.ModegetProgressBackgroundTintMode()

DrawablegetProgressDrawable()

Getthedrawableusedtodrawtheprogressbarinprogressmode.

ColorStateListgetProgressTintList()

Returnsthetintappliedtotheprogressdrawable,ifspecified.

PorterDuff.ModegetProgressTintMode()

Returnstheblendingmodeusedtoapplythetinttotheprogressdrawable,ifspecified.

synchronizedintgetSecondaryProgress()

scurrentlevelofsecondaryprogress.

ColorStateListgetSecondaryProgressTintList()

Returnsthetintappliedtothesecondaryprogressdrawable,ifspecified.

PorterDuff.ModegetSecondaryProgressTintMode()

Returnstheblendingmodeusedtoapplythetinttothesecondaryprogressdrawable,ifspecified.

synchronizedfinalvoidincrementProgressBy(intdiff)

Increasetheprogressbar'

sprogressbythespecifiedamount.

synchronizedfinalvoidincrementSecondaryProgressBy(intdiff)

ssecondaryprogressbythespecifiedamount.

voidinvalidateDrawable(Drawabledr)

InvalidatesthespecifiedDrawable.

synchronizedbooleanisIndeterminate()

Indicatewhetherthisprogressbarisinindeterminatemode.

voidjumpDrawablesToCurrentState()

CallDrawable.jumpToCurrentState()onallDrawableobjectsassociatedwiththisview.

voidonRestoreInstanceState(Parcelablestate)

Hookallowingaviewtore-applyarepresentationofitsinternalstatethathadpreviouslybeengeneratedbyonSaveInstanceState().

ParcelableonSaveInstanceState()

Hookallowingaviewtogeneratearepresentationofitsinternalstatethatcanlaterbeusedtocreateanewinstancewiththatsamestate.

voidpostInvalidate()

Causeaninvalidatetohappenonasubsequentcyclethroughtheeventloop.

synchronizedvoidsetIndeterminate(booleanindeterminate)

Changetheindeterminatemodeforthisprogressbar.

voidsetIndeterminateDrawable(Drawabled)

Definethedrawableusedtodrawtheprogressbarinindeterminatemode.

voidsetIndeterminateDrawableTiled(Drawabled)

Definethetileabledrawableusedtodrawtheprogressbarinindeterminatemode.

voidsetIndeterminateTintList(ColorStateListtint)

Appliesatinttotheindeterminatedrawable.

voidsetIndeterminateTintMode(PorterDuff.ModetintMode)

Specifiestheblendingmodeu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 小学教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1