# MaterialDesignLibrary **Repository Path**: HarmonyOS-tpc/MaterialDesignLibrary ## Basic Information - **Project Name**: MaterialDesignLibrary - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2021-04-01 - **Last Updated**: 2023-04-17 ## Categories & Tags **Categories**: harmonyos-advanced **Tags**: None ## README # Material Design Library ### Demo ![MaterialDesignLibrary](https://gitee.com/openharmony-tpc/MaterialDesignLibrary/raw/master/screenshot/demo.gif) # Usage Solution 1: local har package integration 1. Add the har package to the lib folder. 2. Add the following code to gradle of the entry: ```groovy implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) ``` Solution 2: ```groovy allprojects{ repositories{ mavenCentral() } } implementation 'io.openharmony.tpc.thirdlib:MaterialDesignLibrary:1.0.1' ``` ## Entry Running Requirements 1. Use DevEco Studio and download the SDK. 2. Change the dependencies→classpath version in the build.gradle file to the corresponding version. (that is, the version used in your IDE's new project) ## How to use Some components have custom attributes, if you want use them, you must add this line in your xml file in the first component: ```xml ``` >If you are going to use a ScrollView, it is recommended that you use the CustomScrollView provided in this library to avoid problems with the custom components. >To use this component: ```xml ``` ###### Flat Button ```xml ``` ###### Rectangle Button ```xml ``` ###### Float Button >It is recommended to put this component in the right-bottom of the screen. To use this component write this code in your xml file. >If you don`t want to start this component with animation set the animate attribute to false. >Put your icon in the icon attribute to set the drawable icon for this component. ```xml ``` ###### Float small button ```xml ``` ###### CheckBox ```xml ``` ###### Switch ```xml ``` ###### Progress bar circular indeterminate ```xml ``` ###### Progress bar indeterminate ```xml ``` ###### Progress bar indeterminate determinate ```xml ``` >If you begin progrees, you only have to set progress it ```java progressBarIndeterminateDeterminate.setProgress(progress); ``` ###### Progress bar determinate ```xml ``` >You can custom max and min progress values with `materialdesign:max="50"` and `materialdesign:min="25"` attributes. ```xml ``` ## Widgets ```java SnackBar snackbar = new SnackBar(Context context, String text, String buttonText, Component.ClickedListener onClickListener); snackbar.show(); ``` > If you don't want to show the button, put `null` in `buttonText` attribute ```java Dialog dialog = new Dialog(Context context,String title, String message); dialog.show(); ``` >You can set the accept and cancel button on the event listener or change it's text ```java // Set accept click listenner dialog.setOnAcceptButtonClickListener(Component.ClickedListener onAcceptButtonClickListener); // Set cancel click listenner dialog.setOnCancelButtonClickListener(Component.ClickedListener onCancelButtonClickListener); // Acces to accept button ButtonFlat acceptButton = dialog.getButtonAccept(); // Acces to cancel button ButtonFlat cancelButton = dialog.getButtonCancel(); >``` ```java ColorSelector colorSelector = new ColorSelector(Context context,String intialColor, OnColorSelectedListener onColorSelectedListener); colorSelector.show(); ``` Original link: https://github.com/navasmdc/MaterialDesignLibrary