三种方式绘制图片
程序员文章站
2022-04-17 20:09:30
1. ImageView 绘制图片 ......
1. ImageView 绘制图片
package com.ddx.testimageview; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; import java.io.File; public class ShowImageView extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_image_view); //Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + File.separator + "11.jpg"); Bitmap bitmap = BitmapFactory.decodeFile(Environment.getDataDirectory().getPath() + File.separator + "11.jpg"); Log.d("DDX", "externalStorageDirectory = " + Environment.getExternalStorageDirectory().getPath() + File.separator + "11.jpg"); ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.setImageBitmap(bitmap); } }
上一篇: 我哥居然备着嫂子撩妹
下一篇: 经典台词