Skip to content

Commit 9a7c330

Browse files
committed
Add README
1 parent 39b9ade commit 9a7c330

File tree

3 files changed

+127
-1
lines changed

3 files changed

+127
-1
lines changed

README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# ExpandableTextView
2+
[![JitPack](https://img.shields.io/badge/jitpack-v0.2.0-brightgreen.svg)](https://jitpack.io/#yuzumone/ExpandableTextView/)
3+
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
4+
5+
ExpandableTextView is an android TextView library that performs multiline ellipsize.
6+
7+
## Demo
8+
![Demo](./demo.gif)
9+
10+
## Gradle
11+
### Repository
12+
Add this to your root `build.gradle` file.
13+
```gradle
14+
allprojects {
15+
repositories {
16+
...
17+
maven { url 'https://jitpack.io' }
18+
}
19+
}
20+
```
21+
22+
### Dependency
23+
Add this to your app `build.gradle` file.
24+
```gradle
25+
dependencies {
26+
...
27+
compile 'com.github.yuzumone:ExpandableTextView:0.2.0'
28+
}
29+
```
30+
31+
## Usage
32+
### XML
33+
```xml
34+
<net.expandable.ExpandableTextView
35+
android:id="@+id/text"
36+
android:layout_width="wrap_content"
37+
android:layout_height="wrap_content"
38+
/>
39+
```
40+
41+
### Attributes
42+
```xml
43+
<net.expandable.ExpandableTextView
44+
app:expand="false"
45+
app:expand_enabled="true"
46+
app:collapse_lines="1"
47+
/>
48+
```
49+
50+
## Expand
51+
To set a state the TextView of ellipsize you use the setExpand functionality via xml or kotlin. Default value is false.
52+
53+
### XML
54+
```xml
55+
app:expand="true"
56+
or
57+
app:expand="false"
58+
```
59+
60+
### Kotlin
61+
```kotlin
62+
textView.setExpand(true)
63+
or
64+
textView.setExpand(false)
65+
```
66+
67+
## Expand_enabled
68+
To set a state as to whether expand when clicking you use the setExpandEnabled functionality via xml or kotlin. Default value is true.
69+
70+
### XML
71+
```xml
72+
app:expand_enabled="true"
73+
or
74+
app:expand_enabled="false"
75+
```
76+
77+
### Kotlin
78+
```kotlin
79+
textView.setExpandEnabled(true)
80+
or
81+
textView.setExpandEnabled(false)
82+
```
83+
84+
## Collapse_lines
85+
To set the number of lines when TextView ellipsize you use the setCollapseLines functionality via xml or kotlin. Default value is 1.
86+
87+
### XML
88+
```xml
89+
app:collapse_lines="1"
90+
```
91+
92+
### Kotlin
93+
```kotlin
94+
textView.setCollapseLines(1)
95+
```
96+
97+
## OnExpandableClickListener
98+
99+
```kotlin
100+
textView.setOnExpandableClickListener(object : OnExpandableClickListener {
101+
override fun expand(view: ExpandableTextView) {
102+
// Expand action
103+
}
104+
105+
override fun collapse(view: ExpandableTextView) {
106+
// Collapse action
107+
}
108+
})
109+
```
110+
111+
## License
112+
```
113+
Copyright 2017 yuzumone
114+
115+
Licensed under the Apache License, Version 2.0 (the "License");
116+
you may not use this file except in compliance with the License.
117+
You may obtain a copy of the License at
118+
119+
http://www.apache.org/licenses/LICENSE-2.0
120+
121+
Unless required by applicable law or agreed to in writing, software
122+
distributed under the License is distributed on an "AS IS" BASIS,
123+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124+
See the License for the specific language governing permissions and
125+
limitations under the License.
126+
```

demo.gif

42.1 KB
Loading

expandabletextview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ android {
1212
minSdkVersion 16
1313
targetSdkVersion 25
1414
versionCode 1
15-
versionName "0.1.0"
15+
versionName "0.2.0"
1616
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1717
}
1818
buildTypes {

0 commit comments

Comments
 (0)