Fetch the repository succeeded.
This action will force synchronization from HarmonyOS-TPC/cardslib, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
Card Library provides an easy way to display a UI Card using the Official Google CardView in your homs app.
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)
gradle
allprojects{
repositories{
mavenCentral()
}
}
implementation 'io.openharmony.tpc.thirdlib:cardslib_core:1.0.1'
implementation 'io.openharmony.tpc.thirdlib:cardslib_cards:1.0.1'
//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);
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 |
:---: | :---: |
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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。