Comments (18)
点不出来是什么意思 @zhangqifan1
from expandabletextview.
from expandabletextview.
大佬,是不是我需要设置什么,这里掉不出来 展开 和 收回的 监听
from expandabletextview.
你是不是给TextView设置了点击事件了 @zhangqifan1
from expandabletextview.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/**
-
正常的使用
*/
ExpandableTextView expandableTextView = findViewById(R.id.expand_tv);
//需要显示的内容
String yourText = " 我所认识的**,强大、友好。@奥特曼 “一带一路”经济带带动了沿线国家的经济发展,促进我国与他国的友好往来和贸易发展,可谓“双赢”。http://www.baidu.com 自古以来,**以和平、友好的面孔示人。汉武帝派张骞出使西域,开辟丝绸之路,增进与西域各国的友好往来。http://www.baidu.com 胡麻、胡豆、香料等食材也随之传入**,汇集于中华美食。@rng 漠漠古道,驼铃阵阵,这条路奠定了“一带一路”的基础,让世界认识了**。";
//将内容设置给控件
expandableTextView.setContent(yourText);
//xml中的属性也可以通过代码设置 比如
expandableTextView.setNeedExpend(true);
//还有很多。。。。
//添加点击监听
expandableTextView.setLinkClickListener(new ExpandableTextView.OnLinkClickListener() {
@OverRide
public void onLinkClickListener(LinkType linkType, String content, String selfContent) {
//根据类型去判断
if (linkType.equals(LinkType.LINK_TYPE)) {
Toast.makeText(MainActivity.this, "你点击了链接 内容是:" + content, Toast.LENGTH_SHORT).show();
} else if (linkType.equals(LinkType.MENTION_TYPE)) {
Toast.makeText(MainActivity.this, "你点击了@用户 内容是:" + content, Toast.LENGTH_SHORT).show();
} else if (linkType.equals(LinkType.SELF)) {
Toast.makeText(MainActivity.this, "你点击了自定义规则 内容是:" + content + " " + selfContent, Toast.LENGTH_SHORT).show();
}
}
});//添加展开和收回操作
expandableTextView.setExpandOrContractClickListener(type -> {
if (type.equals(StatusType.STATUS_CONTRACT)) {
Toast.makeText(MainActivity.this, "收回操作", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, "展开操作", Toast.LENGTH_SHORT).show();
}
});
}
}
from expandabletextview.
就这些了 ...
from expandabletextview.
from expandabletextview.
是点了没有弹toast吗
@zhangqifan1
from expandabletextview.
不是,我没有这个方法啊,,
from expandabletextview.
from expandabletextview.
好吧 我看下 @zhangqifan1
from expandabletextview.
你可以用下1.5.2版本
from expandabletextview.
我刚刚检查了下 是有的 你检查下你是不是版本弄错了 @zhangqifan1
from expandabletextview.
大佬,1.5.2可以,你的1.5.3可以么?
from expandabletextview.
我重启下studio吧
from expandabletextview.
恩恩
from expandabletextview.
哈哈,好了,可以了谢谢大佬
from expandabletextview.
可以调出来了
from expandabletextview.
Related Issues (20)
- 您好,有没有办法设置第一行缩进固定距离
- recyclerview调用notifyDataSetChanged部分item的ExpandableTextView已展开的会折叠起来
- 自定义规则能否添加加粗功能
- 链接高亮处于最后时 展开没有高亮
- 链接高亮处于最后时 展开没有高亮
- 识别链接显示错乱
- 为什么这个action(StatusType type)不能切换成对应的状态,而是一个开关作用? HOT 2
- 不知作者是否有支持RTL的打算
- 按照Demo设置不能折叠v1.6.1-x HOT 1
- 能否支持富文本? HOT 6
- 右对齐,如果最后一行的字铺满了最后一行,这个时候的收回换行后会自动下一行第一个,可以去下一行右边吗
- 打开浏览器问题
- 内容里包含表情符号的时候,折叠的时候截取出现乱码的问题
- 相对布局不能展开收起
- 手动展开或收起问题解决方法
- 能否加入一个文字左右两端对齐的功能
- setContent 导致主线程消息产生大量消息 HOT 1
- v1.6.1-x 版本,在 RecyclerView 中保留展开/收起状态不起作用
- 设置 ellipsize = end 不起作用
- 无法下载啊
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expandabletextview.