# MaterialPlayPauseDrawable **Repository Path**: archermind-ti/materialplaypausedrawable ## Basic Information - **Project Name**: MaterialPlayPauseDrawable - **Description**: 带动画的点击控件,可切换播放暂停状态 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2021-04-27 - **Last Updated**: 2025-12-23 ## Categories & Tags **Categories**: harmonyos-button **Tags**: None ## README # MaterialPlayPauseDrawable ### 简介 material design play/pause 的动画 ### 功能 1. 自定义的Material Design 的play/pause Image控件 #### 演示效果 ![sample.gif](preview/sample.gif) ### 集成 1. 在project的build.gradle中添加`mavenCentral()`的引用 ```groovy allprojects { repositories { …… mavenCentral() } } ``` 2. 在需要使用的module的`build.gradle`的文件中,添加如下内容: ```groovy dependencies { implementation 'com.gitee.archermind-ti:material_play_pause_drawable:1.0.1' …… } ``` ### 使用说明 xml文件中定义: ```xml ``` Java中使用: ```java //1. 使用MaterialPlayPauseImage控件 mPlayPauseButton = (MaterialPlayPauseImage)findComponentById(ResourceTable.Id_play_pause); //2. 设置setState或jumpToState MaterialPlayPauseImage.State newState = mPlayPauseButton.getState() == MaterialPlayPauseImage.State.Play ? MaterialPlayPauseImage.State.Pause : MaterialPlayPauseImage.State.Play; mPlayPauseButton.setState(newState); ``` ### 编译说明 1. 将项目通过git clone 至本地 2. 使用DevEco Studio 打开该项目,然后等待Gradle 构建完成 3. 点击`Run`运行即可(真机运行可能需要配置签名) ### 版权和许可信息 ``` Copyright 2018 Zhang Hai 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. ```