Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在android中发送意图时如何使自定义弹出窗口看起来_Java_Android_Android Intent - Fatal编程技术网

Java 在android中发送意图时如何使自定义弹出窗口看起来

Java 在android中发送意图时如何使自定义弹出窗口看起来,java,android,android-intent,Java,Android,Android Intent,我是android新手,我想看起来像这样 这就是我得到的 这里我的问题是,当我试图通过intent send共享内容时,如何在上面的弹出窗口中添加自定义图像和文本 这是我的代码我应该在这里更改什么 Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT,

我是android新手,我想看起来像这样

这就是我得到的

这里我的问题是,当我试图通过intent send共享内容时,如何在上面的弹出窗口中添加自定义图像和文本

这是我的代码我应该在这里更改什么

Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT,
                    "Intall COC!!"+"https://play.google.com/store/apps/details?id=com.supercell.clashofclans");
            sendIntent.setType("text/plain");
            startActivity(sendIntent);

检查你的android版本它只支持从android 11开始

使用下面的代码

Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Here you can make custom title");
            String shareMessage= "\nhere you can make custom message";
            shareMessage = shareMessage + "Intall CoC!!\"+\"https://play.google.com/store/apps/details?id=com.supercell.clashofclans" + BuildConfig.APPLICATION_ID +"\n";
            shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
            startActivity(Intent.createChooser(shareIntent, "choose one"));

是的,我的sdkVersion 25mine 30仍然没有获得此选项,它在Android SDK 30(或更高版本)中工作。