Android how to create runtime thumbnail

后端 未结 9 980
别那么骄傲
别那么骄傲 2020-11-27 09:59

I have a large sized image. At runtime, I want to read the image from storage and scale it so that its weight and size gets reduced and I can use it as a thumbnail. When a u

9条回答
  •  佛祖请我去吃肉
    2020-11-27 10:33

    Use BitmapFactory.decodeFile(...) to get your Bitmap object and set it to an ImageView with ImageView.setImageBitmap().

    On the ImageView set the layout dimensions to something small, eg:

    android:layout_width="66dip" android:layout_height="48dip"
    

    Add an onClickListener to the ImageView and launch a new activity, where you display the image in full size with

    android:layout_width="wrap_content" android:layout_height="wrap_content"
    

    or specify some larger size.

提交回复
热议问题