CProgressButton
Круглая кнопка прогресса, подобная iOS.
Использование:
Добавьте har-пакет в папку libs. В Gradle внутри entry добавьте следующий код:
dependencies {
implementation "io.openharmony.tpc.thirdlib:CProgressButton:1.0.1"
}
//config in your app
CProgressButton.initStatusString(new String[]{"download","pause","complete","error","delete"});
//use
CProgressButton progressButton = (CProgressButton) findComponentById(ResourceTable.Id_btn);
if(progressButton.getState() != CProgressButton.STATE.NORMAL){
progressButton.normal(0/1/2/3); //max value is String[].length - 1; call anytime;
}else{
progressButton.startDownload(); //you must call startDownload() before download(progress);
progressButton.download(progress);
}
layout
<com.jiang.android.pbutton.CProgressButton
ohos:id="$+id:btn3"
ohos:height="30vp"
ohos:width="65vp"
ohos:layout_alignment="center"
ohos:left_margin="50vp"
ohos:text_color="$color:black"
ohos:text_size="12fp"
app:color="$color:black" //all line color the color in bounder.xml
app:drawable_xml="$graphic:bounder3" //bg drawable
app:radius="40vp" //outside radius -> the radius in bounder.xml
app:stroke_width="1vp"/> //stroke outside width -> the width in bounder.xml
graphic-> bounder.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:ohos="http://schemas.huawei.com/res/ohos" ohos:shape="rectangle">
<stroke ohos:color="$color:colorAccent" ohos:width="1vp"/>
<corners ohos:radius="40vp"/>
</shape>
Copyright 2016 NewTab
Licensed under the Apache License, Version 2.0 (the «License»); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an «AS IS» BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарии ( 0 )