1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/HarmonyOS-tpc-CProgressButton

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
README.md 2.3 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
gitlife-traslator Отправлено 26.11.2024 04:16 0e0d840

CProgressButton

Круглая кнопка прогресса, подобная iOS.

Использование:

Gradle

Добавьте 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);
}

XML

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 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/HarmonyOS-tpc-CProgressButton.git
git@api.gitlife.ru:oschina-mirror/HarmonyOS-tpc-CProgressButton.git
oschina-mirror
HarmonyOS-tpc-CProgressButton
HarmonyOS-tpc-CProgressButton
master