# ohos-SwitchView **Repository Path**: wangjian348/ohos-SwitchView ## Basic Information - **Project Name**: ohos-SwitchView - **Description**: A lightweight switch view style for openharmony - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-09-02 - **Last Updated**: 2021-09-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ohos-SwitchView A lightweight switch view style for openharmony # Usage Add SwitchView into xml layout ```xml ``` or custom properties: ```xml ``` Add listener in activty ```java SwitchView sv1 = (SwitchView)findComponentById(ResourceTable.Id_sv1); sv1.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() { @Override public void onCheckedChanged(SwitchView switchView, boolean isChecked) { //do something you want to do } }); ``` ### Gradle 添加har包到libs文件夹内 在entry的gradle内添加如下代码: ```groovy implementation "io.openharmony.tpc.thirdlib:ohos-SwitchView:1.0.2" ```