代码拉取完成,页面将自动刷新
一个倾斜的TextView,适用于标签效果。
方式一:
通过library生成har包,添加har包到libs文件夹内
在entry的gradle内添加如下代码
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
方式二:
allprojects{
repositories{
mavenCentral()
}
}
implementation 'io.openharmony.tpc.thirdlib:SlantedTextView:1.0.0'
通过DevEco studio,并下载SDK 将项目中的build.gradle文件中dependencies→classpath版本改为对应的版本(即你的IDE新建项目中所用的版本)
<?xml version="1.0" encoding="utf-8"?>
<DependentLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
xmlns:app="http://schemas.huawei.com/hap/res-auto"
ohos:height="match_parent"
ohos:width="match_parent">
<DependentLayout
ohos:id="$+id:dl_left_1"
ohos:top_margin="20vp"
ohos:left_margin="100vp"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:id="$+id:left_img"
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:id="$+id:left_text"
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_start="true"
ohos:align_parent_top="true"
app:slantedBackgroundColor="#607D8B"
app:slantedLength="28vp"
app:slantedMode="left"
app:slantedText="ohos"
app:slantedTextColor="#CFD8DC"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:left_margin="100vp"
ohos:id="$+id:dl_left_2"
ohos:below="$+id:dl_left_1"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:id="$+id:right_img"
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
app:slantedBackgroundColor="#ffff00"
app:slantedLength="28vp"
app:slantedMode="left_triangle"
app:slantedText="IOS"
app:slantedTextColor="#607D8B"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:left_margin="100vp"
ohos:id="$+id:dl_left_3"
ohos:below="$+id:dl_left_2"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:id="$+id:imageView"
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_bottom="true"
ohos:align_parent_start="true"
app:slantedBackgroundColor="#4caf50"
app:slantedLength="28vp"
app:slantedMode="left_bottom"
app:slantedText="PHP"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:left_margin="100vp"
ohos:id="$+id:dl_left_4"
ohos:below="$+id:dl_left_3"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_bottom="true"
ohos:align_parent_start="true"
app:slantedBackgroundColor="#C2185B"
app:slantedLength="28vp"
app:slantedMode="left_bottom_triangle"
app:slantedText="WEB"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:right_margin="100vp"
ohos:id="$+id:dl_right_1"
ohos:align_parent_right="true"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_right="true"
app:slantedBackgroundColor="#727272"
app:slantedLength="28vp"
app:slantedMode="right"
app:slantedText="C++"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:right_margin="100vp"
ohos:id="$+id:dl_right_2"
ohos:below="$+id:dl_right_1"
ohos:align_parent_right="true"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_right="true"
app:slantedBackgroundColor="#e91e63"
app:slantedLength="28vp"
app:slantedMode="right_triangle"
app:slantedText="C"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:right_margin="100vp"
ohos:id="$+id:dl_right_3"
ohos:below="$+id:dl_right_2"
ohos:align_parent_right="true"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_right="true"
ohos:align_parent_bottom="true"
app:slantedBackgroundColor="#fbc02d"
app:slantedLength="28vp"
app:slantedMode="right_bottom"
app:slantedText="JS"
app:slantedTextSize="10vp"
/>
</DependentLayout>
<DependentLayout
ohos:top_margin="20vp"
ohos:right_margin="100vp"
ohos:id="$+id:dl_right_4"
ohos:below="$+id:dl_right_3"
ohos:align_parent_right="true"
ohos:height="88vp"
ohos:width="140vp">
<Image
ohos:height="88vp"
ohos:width="140vp"
ohos:image_src="$media:test.jpg"
ohos:scale_mode="stretch">
</Image>
<com.haozhang.lib.SlantedTextView
ohos:height="48vp"
ohos:width="48vp"
ohos:align_parent_right="true"
ohos:align_parent_bottom="true"
app:slantedBackgroundColor="#ff5252"
app:slantedLength="28vp"
app:slantedMode="right_bottom_triangle"
app:slantedText="SWIFT"
app:slantedTextSize="10vp"
/>
</DependentLayout>
</DependentLayout>
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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型