Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.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
Android Studio-文本颜色和图标_Android_Android Alertdialog - Fatal编程技术网

Android Studio-文本颜色和图标

Android Studio-文本颜色和图标,android,android-alertdialog,Android,Android Alertdialog,当我在“多媒体资料”和“照相机”两个选项之间选择时,我将如何更改文本的颜色。我希望它们都是橙色的。 另外,我如何添加一个图标/图像来表示“多媒体资料”和“照相机”,这样当选择该图标时,它将带我进入多媒体资料,以便我可以选择一个图像,或者我可以使用照相机拍照 public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.launch_voip_call) {

当我在“多媒体资料”和“照相机”两个选项之间选择时,我将如何更改文本的颜色。我希望它们都是橙色的。 另外,我如何添加一个图标/图像来表示“多媒体资料”和“照相机”,这样当选择该图标时,它将带我进入多媒体资料,以便我可以选择一个图像,或者我可以使用照相机拍照

public boolean onOptionsItemSelected(MenuItem item) {

        if (item.getItemId() == R.id.launch_voip_call) {
            Utils.startCall(this, contact);
            return true;
        } else if (item.getItemId() == R.id.launch_camera) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("Pick Image from")
                    .setPositiveButton("Camera", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            //camera intent
                            Intent cameraIntent = new Intent(ConversationActivity.this, CameraActivity.class);
                            cameraIntent.putExtra("EXTRA_CONTACT_JID", contact.getJid());
                            startActivity(cameraIntent);
                        }
                    })
                    .setNegativeButton("Gallery", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            Intent intent = new Intent();
                            // Show only images, no videos or anything else
                            intent.setType("image/*");
                            intent.setAction(Intent.ACTION_GET_CONTENT);
                            // Always show the chooser (if there are multiple options available)
                            startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
                        }
                    });
            AlertDialog alert = builder.create();
            alert.show();
        }
}

AlertDialog不是一个很好的选项抱歉为什么不呢?谢谢你可以用主题来降低alertdialog的成本,但我认为这不是一个好的选择。尝试使用DialogFragment,这样更易于使用。