imageview

Create ImageViews dynamically inside a loop

房东的猫 提交于 2019-12-02 23:42:58
I have written this code that loads an image to in ImageView widget: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery); i = (ImageView)findViewById(R.id.imageView1); new get_image("https://www.google.com/images/srpr/logo4w.png") { ImageView imageView1 = new ImageView(GalleryActivity.this); ProgressDialog dialog = ProgressDialog.show(GalleryActivity.this, "", "Loading. Please wait...", true); protected void onPreExecute(){ super.onPreExecute(); } protected void onPostExecute(Boolean result) { i.setImageBitmap(bitmap);

Butterfly animation on Imageview Android [closed]

安稳与你 提交于 2019-12-02 23:15:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I would like to take an Imageview that has a butterfly png and animate it so it looks like the butterfly is moving its wings. How can I get this effect with an Android native animation ? 回答1: I've done that in iOS, so you need to scale it up and scale it down with a timer. 回答2: It

show google drive image with glide in android imageview

故事扮演 提交于 2019-12-02 23:12:01
问题 My drive url is - https://drive.google.com/file/d/0B3DFHb2-MdGYa2NMUkVtVkZ1V1k/view?usp=sharing I want to show it in android imageview using glide. I have tried many ways to show it. Following is my code to show - Glide.with(getActivity()).load(readExcelFeed.getImage().toString()).into(ivQueImage); Please let me know what is the issue in it. 回答1: Unless I'm missing something, you want to show just that single image using Glide. Just right click on it, select "Copy image address", then use

How to create an ImageView that fills the parent height and displays an Image as big as possible?

旧巷老猫 提交于 2019-12-02 22:07:37
I have an ImageView that is defined in the following way: <ImageView android:id="@+id/cover_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_below="@id/title" android:layout_above="@id/divider" android:adjustViewBounds="true" android:src="@drawable/image_placeholder" android:scaleType="fitStart"/> Now after downloading a new bitmap I change the drawable. The image now appears in the top left corner of the ImageView. Is there a way to have the image fill up the whole height that is possible and then adjust the width of the view to enable scaling the

Overlay over an ImageView on Android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 22:03:01
So I have a list of images that come from the web, I don't know which color are they and I want to place a text over the ImageView. My idea is to place the ImageView, an image overlay with transparency gradient over that ImageView and the text above it. I want to mimic this behaviour: Is there anyway to do this via XML? adityajones When you write the XML for your list items which get inflated in the getView(...) of whatever ListAdapter you've written you can surely do this. Something like this for the list item: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:/

android change image onclick imageviev

微笑、不失礼 提交于 2019-12-02 21:31:37
问题 How can I change Image of an Imageview ? I want to get the image associated; if it is img1 I want set the image to img2 , if it is img2 I want to set the image to img2 . 回答1: first set the tag of imageview in xml to 1 final ImageView imageview = (ImageView) findViewById(R.id.imageView1); imageview.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (Integer.parseInt(imageview.getTag().toString()) == 1) { imageview.setBackgroundResource(R.drawable.image2);

Android Bitmap Memory Issue - Error: Out of memory on a 8294416-byte allocation

大城市里の小女人 提交于 2019-12-02 21:02:25
I am currently developing an app that goes through a story. The story contains "scenes" which contain multiple JPEG and PNG files that are displayed via ImageViews. I create the ImageView and add at it to the layout via the following function: private ImageView newImage(Show show) { ImageView iv = new ImageView(this); String filePath = comin.generateFilePath(show); Log.i(TAG, "newImage, filePath = " + filePath + " id = " + show.id); WeakReference<Bitmap> bmp = new WeakReference<Bitmap>(scaleBitmap(filePath)); //added 4/1/13 //Bitmap bmp = scaleBitmap(filePath); Log.i(TAG, "newImage, width = "

how to detect when a ImageView is in collision with another ImageView?

夙愿已清 提交于 2019-12-02 20:43:57
问题 Im developing a test game with some imageviews on the screen. with the finger, i am moving another imageview. I want to detect when the imageview moved by the finger has touched another imageview. ¿Wich is the best way to achieve it? I can't find info about it on google... Thanks 回答1: I'll answer the general question - find out when two views overlap : private boolean viewsOverlap(View v1, View v2) { int[] v1_coords = new int[2]; v1.getLocationOnScreen(v1_coords); int v1_w = v1.getWidth();

Multiple animations on 1 imageview android

浪尽此生 提交于 2019-12-02 20:27:39
I have 2 animations which are already working, i want to fade my train + tween my train on the same time. If I execute 1 of these lines it works. But if I try to execute both it, only 1 will work.. I really can't find a solution here. Maybe you can help? final ImageView mytrain = (ImageView) findViewById(R.id.train); final Animation traintween = AnimationUtils.loadAnimation(this,R.anim.treinanimation); final Animation trainfade = AnimationUtils.loadAnimation(this,R.anim.trainfade); mytrain.startAnimation(trainfade); mytrain.startAnimation(trainntween); I want mytrain to execute both animations

Android: can't remove vertical gap between images in LinearLayout

ε祈祈猫儿з 提交于 2019-12-02 20:26:52
I have a simple LinearLayout in Android with two images vertically: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.eataly.android" android:orientation="vertical" android:background="@android:color/white" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/img_header1" /> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content"