小编bal*_*ala的帖子

如何在 Android Studio 3.6.1 中查看 XML 文件代码

我已将我的 android studio 更新到 3.6.1 。一切看起来都很好,但我找不到要查看的 xml 文件代码。他们删除了左侧角选项以查看 xml 文件的设计/代码。现在我怎么能看到它?

xml android android-studio

27
推荐指数
4
解决办法
6187
查看次数

在上传到服务器之前,如何在 android 中调整/压缩相机图像或图库图像的大小?

我必须上传可以从图库中选择或通过相机拍摄的图像。我已经成功地做到了这一点。但问题是,有时图像大小为 1MB。所以上传到服务器需要更多时间。我需要在上传前调整这张图片的大小。这该怎么做?

 public void onActivityResult(int requestCode, int resultCode, Intent data)
{
    AlertDialog alertDialog1;

    if( requestCode == REQUEST_IMAGE && resultCode == Activity.RESULT_OK ){
        try {
            FileInputStream in = new FileInputStream(destination);
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inSampleSize = 10;
            imagePath = destination.getAbsolutePath();
            Bitmap bmp = BitmapFactory.decodeStream(in, null, options);
            //img = (ImageView) findViewById(R.id.imageView1);
            int nh = (int) ( bmp.getHeight() * (512.0 / bmp.getWidth()) );
            Bitmap scaled = Bitmap.createScaledBitmap(bmp, 512, nh, true);
            img.setImageBitmap(scaled);
        } catch (Exception e) {
            // AlertDialog alertDialog1;
            alertDialog1 = new …
Run Code Online (Sandbox Code Playgroud)

android image-resizing

5
推荐指数
1
解决办法
9965
查看次数

标签 统计

android ×2

android-studio ×1

image-resizing ×1

xml ×1