【发布时间】:2020-12-08 15:26:58
【问题描述】:
在Customadapter.java文件中,这部分代码我已经写在下面了。
当我点击任何列表视图项目时,共享窗口打开,但我看不到 createChooser 中提到的标题“共享使用”。请帮助我。
CustomAdapter.java
public View getView(int position, View view, ViewGroup viewGroup) {
LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v=inflater.inflate(R.layout.custom,null);
TextView tv1=v.findViewById(R.id.textView);
final TextView tv2=v.findViewById(R.id.textView2);
TextView tv3=v.findViewById(R.id.textView3);
tv1.setText(arrayList.get(position).getId()+"");
tv2.setText(arrayList.get(position).getName());
tv3.setText(arrayList.get(position).getAddress());
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent ();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, tv2.getText().toString());
intent.setType("text/plain");
context.startActivity(
Intent.createChooser(
intent,
"Share using"
)
);
}
});
return v;
}
【问题讨论】:
-
标题是否出现取决于操作系统版本和可能的设备制造商。
-
那么如何知道哪些会显示哪些不会呢?
-
一般来说,你不会。您提供标题,是否显示将取决于具体情况。
-
在哪里提到为什么不显示?
标签: android android-studio android-intent android-listview android-adapter