devilist / Advancedtextview
Licence: apache-2.0
一个增强的TextView库。可以实现文字两端对齐,文字竖排,以及自定义选择文字后的弹出菜单。
Stars: ✭ 365
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Advancedtextview
Swiftuix
Extensions and additions to the standard SwiftUI library.
Stars: ✭ 4,087 (+1019.73%)
Mutual labels: textview
EasyMoney-Widgets
The widgets (EditText and TextView) for support of money requirements like currency, number formatting, comma formatting etc.
Stars: ✭ 91 (-75.07%)
Mutual labels: textview
TTInputVisibilityController
Lightweight controller to keep your inputs visible when the keyboard is presented.
Stars: ✭ 21 (-94.25%)
Mutual labels: textview
Android-SGTextView
同时带字体描边 渐变 阴影的TextView - both have stroker, gradient and shadow TextView
Stars: ✭ 18 (-95.07%)
Mutual labels: textview
Dropdowntextview
Simple drop-down(expandable) TextView for Android
Stars: ✭ 307 (-15.89%)
Mutual labels: textview
textmatcher
A simple text watcher that matches specific targets like mention or hashtag in a string by defining rules
Stars: ✭ 67 (-81.64%)
Mutual labels: textview
react-native-highlighted-text
A React Native component to individually style texts inside a text
Stars: ✭ 18 (-95.07%)
Mutual labels: textview
KodeEditor
A simple code editor with syntax highlighting and pinch to zoom
Stars: ✭ 60 (-83.56%)
Mutual labels: textview
Spedittool
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292 (-20%)
Mutual labels: textview
embedded-text
Multiline TextBox for the embedded-graphics Rust crate
Stars: ✭ 35 (-90.41%)
Mutual labels: textview
CustomFontView
Custom View classes for TextView, EditText & Buttons - to set custom fonts
Stars: ✭ 26 (-92.88%)
Mutual labels: textview
Rtextview
基于TextView 1.直接设置selector背景2.直接设置drawableLeft大小 3.圆角,圆形,背景/边框/文字根据状态变色
Stars: ✭ 359 (-1.64%)
Mutual labels: textview
Attributedstring
基于Swift插值方式优雅的构建富文本, 支持点击长按事件, 支持不同类型过滤, 支持自定义视图等.
Stars: ✭ 294 (-19.45%)
Mutual labels: textview
Android Expandabletextview
An expandable TextView for Android applications
Stars: ✭ 268 (-26.58%)
Mutual labels: textview
AdvancedTextView
这是一个增强的TextView库。可以实现文字的两端对齐,文字竖排,以及自定义的弹出菜单。
具体介绍请移步博客:
https://blog.csdn.net/devilist/article/details/54911641
https://blog.csdn.net/devilist/article/details/79236665
本库目前提供两个控件 SelectableTextView 和 VerticalTexview。
1. SelectableTextView
在布局中引用:
<com.devilist.advancedtextview.SelectableTextView
android:id="@+id/ctv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#FDFBF8"
android:lineSpacingMultiplier="1.5"
android:padding="5dp"
android:textColor="#808080"
android:textSize="16sp"
app:forbiddenActionMenu="false" // 是否禁用自定义ActionMenu
app:textHeightColor="@color/colorAccent" // 文本高亮色
app:textJustify="false" /> // 是否启用两端对齐
也可以在代码中设置:
selectableTextView.setTextJustify(true); // 是否启用两端对齐 默认启用
selectableTextView.setForbiddenActionMenu(false); // 是否禁用自定义ActionMenu 默认启用
selectableTextView.setTextHighlightColor(0xff48543e); // 文本高亮色
注意:在代码中调用上述三个方法后需要 调用 inviladite() 或 postInviladite()方法通知View重绘
设置ActionMenu菜单点击监听:
selectableTextView.setCustomActionMenuCallBack(new CustomActionMenuCallBack() {
@Override
public boolean onCreateCustomActionMenu(ActionMenu menu) {
menu.setActionMenuBgColor(0xff666666); // ActionMenu背景色
menu.setMenuItemTextColor(0xffffffff); // ActionMenu文字颜色
List<String> titleList = new ArrayList<>();
titleList.add("翻译");
titleList.add("分享");
titleList.add("分享");
menu.addCustomMenuItem(titleList); // 添加菜单
return false; // 返回false,保留默认菜单(全选/复制);返回true,移除默认菜单
}
@Override
public void onCustomActionItemClicked(String itemTitle, String selectedContent) {
Toast.makeText(this, "ActionMenu: " + itemTitle, Toast.LENGTH_SHORT).show();
}
});
2. VerticalTextView
在布局中引用:
<com.devilist.advancedtextview.VerticalTextView
android:id="@+id/vtv_text_ltr"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#FDFBF8"
android:gravity="center"
android:padding="15dp"
android:textColor="#808080"
android:textSize="16sp"
app:charSpacingExtra="2dp" // 字符间距
app:lineSpacingExtra="15dp" // 行间距
app:showActionMenu="true" // 是否开启ActionMenu,默认关闭
app:textLeftToRight="true" // 文字是否从左向右排版,默认从右向左排版
app:underLineText="true" // 是否显示下划线,默认不显示
app:underLineColor="#CEAD53" // 下划线颜色
app:underLineWidth="2.5" // 下划线线宽
app:textHeightLightColor="@color/colorAccent" // 选中文字高亮色
app:underlineOffset="3dp" /> // 下划线偏移量
在代码中设置:
vtv_text_ltr.setLeftToRight(true) // 文字是否从左向右排版,默认从右向左排版
.setLineSpacingExtra(10) // 行间距
.setCharSpacingExtra(2) // 字符间距
.setUnderLineText(true) // 是否显示下划线,默认不显示
.setShowActionMenu(true) // 是否开启ActionMenu,默认关闭
.setUnderLineColor(0xffCEAD53) // 下划线颜色
.setUnderLineWidth(1.0f) // 下划线线宽
.setUnderLineOffset(3) // 下划线偏移量
.setTextHighlightColor(0xffCEAD53) // 选中文字高亮色
.setCustomActionMenuCallBack(this); // ActionMenu菜单点击监听
注意:在代码中调用上述方法后需要 调用 requestLayout()方法通知View重新布局
设置ActionMenu菜单点击监听和SelectableTextView一样。
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].