这里,下面的代码将分享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/