Skip to content

This is based on an open source autosizing textview for HMOS.

License

Notifications You must be signed in to change notification settings

Applib-HarmonyOS/SizeAdjustingTextView

Repository files navigation

.github/workflows/main.yml Quality Gate Status

SizeAdjustingTextView

This is based on an open source autosizing text component for Hmos.

Source

Inspired by erchenger/SizeAdjustingTextView

Feature

SizeAdjustingTextView is a library that allows user to input text of any length of characters which will auto resize the text within the custom component. Resizing multiple lines in the text component to keep up the changes.

Dependency

  1. For using sizeadjustingtextview module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
    dependencies {
       implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
       implementation project(path: ':sizeadjustingtextview')
       testImplementation 'junit:junit:4.13'
       ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
}
  1. For using sizeadjustingtextview 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'])
             testImplementation 'junit:junit:4.13'
        }
  1. For using sizeadjustingtextview from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
         dependencies {
             implementation 'dev.applibgroup:sizeadjustingtextview:1.0.0'
             testCompile 'junit:junit:4.13'
         }

Usage

In code

XML: 
<com.omitneedlesscode.sizeadjustingtextview.SizeAdjustingTextView
        ohos:id="$+id:topBox"
        ohos:height="75vp"
        ohos:width="match_parent"
        ohos:background_element="#EE00FF"
        ohos:below="$id:text_input"
        ohos:multiple_lines="true"
        ohos:padding="0vp"
        ohos:text_alignment="center"
        ohos:text_color="#000000"
        ohos:text_size="32fp"/>

JAVA:
        SizeAdjustingTextView mTopMessageBox = (SizeAdjustingTextView) findComponentById(ResourceTable.Id_topBox);
        TextMover.moveTextFromCellToCell(mBottomMiddleBox, mBottomRightBox);

About

This is based on an open source autosizing textview for HMOS.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages