5 Star 1 Fork 1

HarmonyOS-TPC / SlantedTextView

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

SlantedTextView

一个倾斜的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' 

entry运行要求

通过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>

License


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.
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.

简介

一个倾斜的TextView,适用于标签效果 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HarmonyOS-tpc/SlantedTextView.git
git@gitee.com:HarmonyOS-tpc/SlantedTextView.git
HarmonyOS-tpc
SlantedTextView
SlantedTextView
master

搜索帮助