# SlidingDrawer **Repository Path**: HarmonyOS-tpc/SlidingDrawer ## Basic Information - **Project Name**: SlidingDrawer - **Description**: SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 1 - **Created**: 2021-04-01 - **Last Updated**: 2023-04-17 ## Categories & Tags **Categories**: harmonyos-advanced **Tags**: None ## README # SlidingDrawer SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen. SlidingDrawer can be used vertically or horizontally. A special widget composed of two children views: the handle, that the users drags, and the content, attached to the handle and dragged with it. SlidingDrawer should be used as an overlay inside layouts. This means SlidingDrawer should only be used inside of a FrameLayout or a RelativeLayout for instance. The size of the SlidingDrawer defines how much space the content will occupy once slid out so SlidingDrawer should usually use match_parent for both its dimensions. ## SlidingDrawer includes : 1. Sliding Drawer Via Java & XML 2. Customizing the Handle 3. Customizing the Content 4. Supports Animate open & Animate Close 5. Supports Call back functions 6. Sliding Horizontal and Vertical | [horizontal] | [vertical] |:-:|:-:| | ![ic_horizontal] | ![ic_vertical] | # Usage Instructions A sample project which provides runnable code examples that demonstrate uses of the classes in this project is available in the entity/ folder. Step1:- We can set the layout in 2 ways:- Option1:-Define the custom drawer Layout as below in xml ``` ``` OR Option2:-Define Drawer dynamically with code. Initialize ``` SlidingDrawer drawer = new SlidingDrawer(this);` ``` Set properties for drawer. ``` drawer.setOrientation(Component.VERTICAL);//default is vertical drawer.setHandle(new Component(this));//this must be set drawer.setHolder(your view with your content any type of view or layout);` ``` And use ``` drawer.open(); drawer.close(); drawer.animateOpen(); drawer.animateClose(); drawer.toggle();` ``` # Installation Instructions 1. For using SlidingDrawer module in sample app, include the below library dependency to generate hap/ SlidingDrawer.har: Modify entry build.gradle as below : ``` dependencies { implementation project(path: ': slidingdrawer') } ``` 2. For using SlidingDrawer in separate application make sure to add the SlidingDrawer.har in entry libs folder. Modify entry build.gradle as below : ``` dependencies { implementation fileTree(dir: 'libs', include: [' *.jar', ' *.har']) } ``` 3. For using SlidingDrawer from a remote repository in separate application, add the below dependencies: Modify entry build.gradle as below : ``` dependencies { implementation fileTree(dir: 'libs', include: ['*.har']) implementation 'io.openharmony.tpc.thirdlib:SlidingDrawer:1.0.2' } ``` # License ``` Copyright 2014 Igor Morais Copyright (C) 2008 The Android Open Source Project 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. ``` [ic_horizontal]: [ic_vertical]: