|
1 | 1 | # MagicalTextView
|
| 2 | +[](https://jitpack.io/#yangsanning/MagicalTextView) |
| 3 | + |
| 4 | +## 效果预览 |
| 5 | + |
| 6 | +<p><img src="images/mageicalTextviewImage1.png" height="512"/> |
| 7 | + |
| 8 | + |
| 9 | +## 主要文件 |
| 10 | +| 名字 | 摘要 | |
| 11 | +| ---------------- | -------------- | |
| 12 | +| MagicalTextView | 末尾增加详情点击按钮的TextView | |
| 13 | + |
| 14 | +### 1. 基本用法 |
| 15 | + |
| 16 | +```android |
| 17 | +<ysn.com.magicaltextview.MagicalTextView |
| 18 | + android:layout_width="match_parent" |
| 19 | + android:layout_height="wrap_content" |
| 20 | + android:background="@android:color/white" |
| 21 | + app:mtv_details_image_height="30dp" |
| 22 | + app:mtv_details_image_width="20dp" |
| 23 | + app:mtv_padding_bottom="12dp" |
| 24 | + app:mtv_details_text="详细分析" |
| 25 | + app:mtv_force_max_height="true" |
| 26 | + app:mtv_default_text="@string/text1" |
| 27 | + app:mtv_details_text_color="@color/mtv_details_text_color" |
| 28 | + app:mtv_max_line="3" |
| 29 | + app:mtv_row_width="10dp" |
| 30 | + app:mtv_bold_text_size="18sp" |
| 31 | + app:mtv_padding_left="12dp" |
| 32 | + app:mtv_default_text_size="16sp" |
| 33 | + app:mtv_details_image="@drawable/ic_arrow_blue" |
| 34 | + app:mtv_padding_right="12dp" |
| 35 | + app:mtv_padding_top="12dp" |
| 36 | + app:mtv_details_text_size="11sp" /> |
| 37 | +``` |
| 38 | + |
| 39 | +### 2. 配置属性([Attributes](https://github.com/yangsanning/MagicalTextView/blob/master/magicaltextview/src/main/res/values/attrs.xml)) |
| 40 | + |
| 41 | +|name|format|description| |
| 42 | +|:---:|:---:|:---:| |
| 43 | +|mtv_padding_left |dimension |左边距 | |
| 44 | +|mtv_padding_top |dimension |上边距 | |
| 45 | +|mtv_padding_right |dimension |右边距 | |
| 46 | +|mtv_padding_bottom |dimension |下边距 | |
| 47 | +|mtv_bold_text_color |color |文本开头加粗文本颜色 | |
| 48 | +|mtv_bold_text_size |dimension |文本开头加粗文本字号 | |
| 49 | +|mtv_bold_end_index |integer |文本开头加粗文本结束的index | |
| 50 | +|mtv_default_text_color |color |默认文本颜色 | |
| 51 | +|mtv_default_text_size |dimension |默认文本字号 | |
| 52 | +|mtv_default_text |string |默认文本 | |
| 53 | +|mtv_details_text_color |color |详情分析文本颜色 | |
| 54 | +|mtv_details_text_size |dimension |详情分析文本字号 | |
| 55 | +|mtv_details_text |string |详情分析文本 | |
| 56 | +|mtv_details_margin_left |dimension |详情分析距离默认文本的左边距 | |
| 57 | +|mtv_details_image |reference |文本末尾小图标 | |
| 58 | +|mtv_details_image_width |dimension |文本末尾小图标宽度 | |
| 59 | +|mtv_details_image_height |dimension |文本末尾小图标高度 | |
| 60 | +|mtv_details_image_margin_left |dimension |文本末尾小图标距离详情分析的左边距 | |
| 61 | +|mtv_row_width |dimension |行宽 | |
| 62 | +|mtv_max_line |integer |最大行数 | |
| 63 | +|mtv_force_max_height |boolean |文本行数小于最大行数时, 是否强制高度 | |
| 64 | + |
| 65 | + |
| 66 | +### 3.添加方法 |
| 67 | + |
| 68 | +#### 3.1 添加仓库 |
| 69 | + |
| 70 | +在项目的 `build.gradle` 文件中配置仓库地址。 |
| 71 | + |
| 72 | +```android |
| 73 | +allprojects { |
| 74 | + repositories { |
| 75 | + ... |
| 76 | + maven { url 'https://jitpack.io' } |
| 77 | + } |
| 78 | + } } |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +#### 3.2 添加项目依赖 |
| 83 | + |
| 84 | +在需要添加依赖的 Module 下添加以下信息,使用方式和普通的远程仓库一样。 |
| 85 | + |
| 86 | +```android |
| 87 | + implementation 'com.github.yangsanning:MagicalTextView:v1.0.7' |
| 88 | +``` |
0 commit comments