java - 分享时将标题文字加粗

标签 java android share-intent

这里,下面的代码将分享onclick的内容。通过其他应用分享内容时,有两种内容:一种是 ti - 标题,另一种是 de - 描述。我想在分享时将标题加粗。这可能吗?

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"));

关于java - 分享时将标题文字加粗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52042434/

相关文章:

java - 创建 hello world hibernate 项目的问题

android - Android 上不适合 React Native 的应用类型

android - 在 Android 中共享图像和文本

android - 进程在共享图像期间已停止

java - 将一个字节分解为 8 位最简单?

java - EntityManager 始终为 null 并且未正确注入(inject)

java.io.FileNotFoundException :/storage/emulated/0/Android/data/MyApplication/MyFile. ICS。 (没有这样的文件或目录)/Android Studio/Ical4j

java - 安卓 : Share intent is not working for video file path

java - 如何正确使用Map.Entry接口(interface),为什么Map.Entry的方法已经实现了?

android - 使用 jquery 查找键盘可见