# cardslib **Repository Path**: cbdWork/cardslib ## Basic Information - **Project Name**: cardslib - **Description**: Card Library provides an easy way to display a UI Card using the Official Google CardView in your homs app. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-06-30 - **Last Updated**: 2024-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # cardslib Card Library provides an easy way to display a UI Card using the Official Google CardView in your homs app. ## How to build? ``` 1.Delete the visible tag from the config.json file. 2.For entry running requirements, use DevEco Studio and download the openHarmonySDK. 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 for your project? gradle ``` allprojects{ repositories{ mavenCentral() } } implementation 'io.openharmony.tpc.thirdlib:cardslib_core:1.0.1' implementation 'io.openharmony.tpc.thirdlib:cardslib_cards:1.0.1' ``` ## How to use? #### Create a Card ``` //Create a Card Card card = new Card(this); //Create a CardHeader CardHeader header = new CardHeader(this); //Set the header title try { header.setTitle(getResourceManager().getElement(ResourceTable.String_demo_header_basetitle).getString()); } catch (Exception e) { HiLog.error(Constants.LABEL_LOG, e.toString()); } card.addCardHeader(header); //Set card in the CardView CardView cardView = (CardView) findComponentById(ResourceTable.Id_carddemo_header_std); cardView.setCard(card); ``` #### addCardExpand ``` header.setButtonExpandVisible(true); //This provides a simple (and useless) expand area CardExpand expand = new CardExpand(this); //Set inner title in Expand Area try { expand.setTitle(getResourceManager().getElement(ResourceTable.String_demo_expand_basetitle).getString()); } catch (Exception e) { HiLog.error(Constants.LABEL_LOG, e.toString()); } card.addCardExpand(expand); ``` ##screenshot |card add header|card add expand| |:---:|:---:| || |material_card|top_color_expand| |:---:|:---:| || |list_base|refresh_card| |:---:|:---:| || |list_different_layout|list_sections| |:---:|:---:| || |misc|colored_cards| |:---:|:---:| || License ------- Copyright 2013-2014 Gabriele Mariotti 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. ---