Skip to content

Repository files navigation

BuildQuality Gate Status

SharpView

It is a HMOS Library which provides a Custom TextView,LinearLayout,RelativeLayout with sharpView

Source

The code in this repository was inspired from zengzhaoxing/SharpView - Release v2.4.7. We are very thankful to zengzhaoxing.

Screenshot

Directions

  • custom properties
nameformatinstructions
radiusdimensioncorner radius size
backgroundColorcolorBackground color (be careful not to use HMPS native background-related attributes such as: background_element)
arrowDirectionenumSharpView relative position (top, left, right, bottom)
relativePositionfractionRelative position of sharpview in fraction
sharpSizedimensionSharpview size, 0 means no sharp corners are displayed, the default is 0
borderdimensionBorder size, default is 0
borderColorcolorBorder color
startBgColorcolorGradient initial color (required for gradient)
middleBgColorcolorGradient middle color (optional when gradient)
endBgColorcolorGradient end color (required for gradient)

Gradient colors are only valid when sharpSize is 0 (no sharp corners)

Dependency

  1. For using SharpView module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
	dependencies {
implementation project(':sharpview')
implementation fileTree(dir: 'libs', include: ['*.har'])
testCompile 'junit:junit:4.12'
}
  1. For using SharpView in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
	dependencies {
implementation fileTree(dir: 'libs', include: ['*.har'])
testCompile 'junit:junit:4.12'
}
  1. For using SharpView from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
	dependencies {
implementation 'dev.applibgroup:sharpview:1.0.0'
testCompile 'junit:junit:4.12'
}

Usage

  • 1.In the XML
 <com.zhaoxing.view.sharpview.SharpEditText
ohos:width="match_content"ohos:height="match_content"ohos:left_margin="50vp"ohos:text_color="#FFFFFF"ohos:text="this is a SharpTextView"ohos:text_size="30vp"app:backgroundColor="#FFFF0000"app:arrowDirection="left"app:relativePosition="0.5"app:sharpSize="10vp"
/>
<com.zhaoxing.view.sharpview.SharpLinearLayout
ohos:width="700vp"ohos:height="200vp"ohos:orientation="vertical"ohos:margin="50vp"app:radius="10vp"app:arrowDirection="right"app:backgroundColor="#FF000000"app:relativePosition="0.9"app:sharpSize="15vp"
/>
  • 2.In the code
SharpLinearLayoutsharpLinearLayout = (SharpLinearLayout) findViewById(ResourceTable.Id_sharp_ll);
//get the SharpViewRenderProxy of the sharpView to refresh sharp)sharpLinearLayout.getRenderProxy().setArrowDirection(SharpView.ArrowDirection.BOTTOM);
sharpLinearLayout.getRenderProxy().setSharpSize(50);
sharpLinearLayout.getRenderProxy().setRelativePosition(0.8f);
sharpLinearLayout.getRenderProxy().setRadius(20);
sharpLinearLayout.getRenderProxy().setBackgroundColor(0xff000000);

Usage

publicclassSharpEditTextextendsTextFieldpublicclassSharpTextViewextendsTextpublicclassSharpLinearLayoutextendsDirectionalLayoutpublicclassSharpRelativeLayoutextendsDependentLayoutpublicclassSharpImageViewextendsImage

Author

name : 曾宪梓
email : 1071481464@qq.com

License

Copyright 2017 zengzhaoxing

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.

About

HarmonyOS controls with sharp-angled bubbles (TextView, ImageView, EditText, Layout), support custom attributes such as gradient color, rounded corners, etc.

Topics

Resources

Stars

0 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages