imageview

How to add a shadow and a border on circular imageView android?

喜夏-厌秋 提交于 2019-11-26 02:29:15
问题 I created a CircularImageView with this question: Create circular image view in android Download project on GitHub 1) This is the CircularImageView class : public class CircularImageView extends ImageView { public CircularImageView(Context context) { super(context); } public CircularImageView(Context context, AttributeSet attrs) { super(context, attrs); } public CircularImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void

How to set tint for an image view programmatically in android?

纵然是瞬间 提交于 2019-11-26 02:16:32
问题 Need to set tint for an image view... I am using it the following way: imageView.setColorFilter(R.color.blue,android.graphics.PorterDuff.Mode.MULTIPLY); But it doesn\'t change... 回答1: You can change the tint, quite easily in code via: imageView.setColorFilter(Color.argb(255, 255, 255, 255)); // White Tint If you want color tint then imageView.setColorFilter(ContextCompat.getColor(context, R.color.COLOR_YOUR_COLOR), android.graphics.PorterDuff.Mode.MULTIPLY); For Vector Drawable imageView

Listview click to show image in ImageView

為{幸葍}努か 提交于 2019-11-26 02:11:06
I follow this tutorial http://wptrafficanalyzer.in/blog/android-lazy-loading-images-and-text-in-listview-from-http-json-data/ . and I wonder, how can i click the listview item and show the image of flag in imageview check below code it may help you for click on listview Items. i check this link . and i assume that you are aware of custom listview. public class ListViewAdapter_test extends BaseAdapter { private LayoutInflater mInflater; public ListViewAdapter_test(Context con) { // TODO Auto-generated constructor stub mInflater = LayoutInflater.from(con); } public int getCount() { // TODO Auto

android - save image into gallery

穿精又带淫゛_ 提交于 2019-11-26 01:13:05
问题 i have an app with a gallery of images and i want that the user can save it into his own gallery. I\'ve created an option menu with a single voice \"save\" to allow that but the problem is...how can i save the image into the gallery? this is my code: @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.menuFinale: imgView.setDrawingCacheEnabled(true); Bitmap bitmap = imgView.getDrawingCache(); File root = Environment

Border for an Image view in Android?

≡放荡痞女 提交于 2019-11-26 01:10:47
问题 How can I set a border for an ImageView and change its color in Android? 回答1: I set the below xml to the background of the Image View as Drawable. It works. <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFF" /> <stroke android:width="1dp" android:color="#000000" /> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> </shape> And then add android:background="@drawable

Listview click to show image in ImageView

牧云@^-^@ 提交于 2019-11-26 01:09:07
问题 I follow this tutorial http://wptrafficanalyzer.in/blog/android-lazy-loading-images-and-text-in-listview-from-http-json-data/. and I wonder, how can i click the listview item and show the image of flag in imageview 回答1: check below code it may help you for click on listview Items. i check this link. and i assume that you are aware of custom listview. public class ListViewAdapter_test extends BaseAdapter { private LayoutInflater mInflater; public ListViewAdapter_test(Context con) { // TODO

Adding gif image in an ImageView in android

不羁岁月 提交于 2019-11-26 00:45:25
问题 I added an animated gif image in an imageView. I am not able to view it as a gif image. No animation is there. It\'s appearing just as a still image. I would like to know how can i show it as a gif image. 回答1: First, copy your GIF image into Asset Folder of your app create following classes and paste the code AnimationActivity: - public class AnimationActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super

Custom ImageView with drop shadow

落花浮王杯 提交于 2019-11-26 00:23:11
问题 Okay, I\'ve been reading and searching around, and am now banging my head against the wall trying to figure this out. Here\'s what I have so far: package com.pockdroid.sandbox; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.widget.ImageView; public class ShadowImageView extends ImageView { private Rect mRect; private Paint mPaint; public ShadowImageView(Context context)

Caching images and displaying

江枫思渺然 提交于 2019-11-26 00:19:32
问题 Hello Am facing a particular problem in which I need to download images and display them onto a ListView corresponding to their particular TextView\'s . The code I have is successfully displaying the The TextView\'s I need to display but I don\'t know how to display all these different images next to my text views in my ListView . After going through many threads in SO. The top answers are to solve this by 1. Lazy List 2. Universal Image Loader I have gone through both the solutions. I

Show Image View from file path?

三世轮回 提交于 2019-11-26 00:17:22
问题 I need to show an image by using the file name only, not from the resource id. ImageView imgView = new ImageView(this); imgView.setBackgroundResource(R.drawable.img1); I have the image img1 in the drawable folder. I wish to show that image from the file. How can I do this? 回答1: Labeeb is right about why you need to set image using path if your resources are already laying inside the resource folder , This kind of path is needed only when your images are stored in SD-Card . And try the below