首页 > 解决方案 > 分享时将标题文字加粗

问题描述

在这里,下面的代码将分享内容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;
    }
});

标签: javaandroidshare-intent

解决方案


如果您想在 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"));

推荐阅读