java - 分享时将标题文字加粗
问题描述
在这里,下面的代码将分享内容onclick。通过其他应用分享内容时,有两种内容:一种是ti-title,另一种是de-description。我想在分享时把标题加粗。那可能吗?
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
TextView de = (TextView) v.findViewById(R.id.lblListItem);
TextView ti = (TextView) v.findViewById(R.id.lblListHeader);
String selected = ti.getText().toString() + de.getText().toString();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, selected);
startActivity(Intent.createChooser(intent, "Share via"));
return false;
}
});
解决方案
如果您想在 Whatsapp 上分享任何内容,那么有一个小技巧,只需在任何文本的开头和文本的结尾使用“*”,那么您在 Whatsapp 上的文本将显示为粗体。
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
String shareMessage = "*"+"Download theguruji app for more news\n\n"+"*";
intent.putExtra(Intent.EXTRA_TEXT, shareMessage);
intent.setType("text/plain");
startActivity(Intent.createChooser(intent, "Share via"));
推荐阅读
- google-cloud-platform - 在 gcp 中限制用户对 VM 的访问
- ios - ionic 5/ Angular 8 - ios 无法连接到本地网络服务器
- android - 每次我打开一个项目时,Android Studio 构建工具都会出错
- python - 如何对 PIL 图像进行零填充?
- javascript - 这个结构在 Javascript 中叫什么
- javascript - JavaScript date variable is returning incorrect dates for string input
- eclipse - 如何在 Eclipse 中将自定义操作集添加到我的自定义透视图中?
- python - Flask 应用程序中的 Opencv 视频
- javascript - Firebase:使用预留托管 URL 时未创建 Firebase 应用“[DEFAULT]”
- ffmpeg - 我们指定使用 ffmpeg 的 Mozilla、MacOS 和 Safari 版本有什么区别?