imageview

Android: How to compare resource of an image with R.drawable.imagename?

混江龙づ霸主 提交于 2019-12-21 20:49:12
问题 I am working on a sample application in which I need to get the resource of an image view in a onClick listener and compare that with the image source that I know exists. If the resources are the same, I want to launch another intent. The problem I am facing right now is to access that ImageView (and hence its resource Id integer) to compare to the drawable resource. @Override // should int be final ?? public View getView(final int position, View convertView, ViewGroup parent) { ImageView

Faster way to load an image from a URL and display it in an iPhone app

有些话、适合烂在心里 提交于 2019-12-21 19:59:32
问题 I am using the following code to display an image in my ImageView: imgbackBG.image = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", [test.arrImagessplash objectAtIndex:[test.arrImages count]-4]]]]]; 4cing.com/mobile_app/uploads/pageicon/splash.png The problem is that the code executes very slowly. Is there a way to load the image and display it in the ImageView more quickly? If so, how can I do this? 回答1: Download the Files

Blurry Image on API 21+ : AppCompat v23.2.0 using VectorDrawables with srcCompat

耗尽温柔 提交于 2019-12-21 19:40:07
问题 I have an image display issue on API 21+, but everything works fine on lower devices and API 22+. I'm using Gradle Plugin 1.5, so my build.gradle look like this: // Gradle Plugin 1.5 android { defaultConfig { generatedDensities = [] } // This is handled for you by the 2.0+ Gradle Plugin aaptOptions { additionalParameters "--no-version-vectors" } } Image View in XML: <ImageView android:id="@+id/landing_img_slide" android:layout_width="225dp" android:layout_height="225dp" android:layout

Android Gestures over an image [closed]

ⅰ亾dé卋堺 提交于 2019-12-21 19:26:28
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm continuing my learning with android and have now reached the point where I'm plating with gestures. What I have so far is a

ViewPager + Picasso

风格不统一 提交于 2019-12-21 17:06:05
问题 I'm creating a Image Slider using Picasso + Viewpager. I am able to swipe the slider base on the image size(counts). But no images has been loaded tho i can swipe the screen. What is wrong with my codes? In my MainActivity, I get the links of my images. then set the adapter Like this. viewPager = (ViewPager)findViewById(R.id.view_pager); viewPagerAdapter = new ViewPagerAdapter(MainActivity.this,IMAGES); viewPager.setAdapter(viewPagerAdapter); IMAGES=Arrays of Links(For images). My ImagePager

setScaleType to ScaleType.MATRIX programmatically not work but in xml it work

你离开我真会死。 提交于 2019-12-21 09:24:06
问题 this is my code : LinearLayout imageViewParent = (LinearLayout) findViewById(R.id.imageViewParent); ImageView view = new ImageView(this); imageViewParent.addView(view); view.setScaleType(ScaleType.MATRIX); view.setBackgroundResource(R.drawable.np); In this code scale type to matrix not work(it fix image to parents),but when I implement this in xml it works fine! can every one help me? thank you! 回答1: You should use setImageResource not setBackgroundResource. 回答2: Use this: view

Making an image circular with white circular border

◇◆丶佛笑我妖孽 提交于 2019-12-21 07:36:37
问题 How to make an image circular and give it white circular border? Is it necessary to use two image views – one for the image and other for the white border? Is there any other way to do this? 回答1: Try this... public static Bitmap getCircularBitmapWithWhiteBorder(Bitmap bitmap, int borderWidth) { if (bitmap == null || bitmap.isRecycled()) { return null; } final int width = bitmap.getWidth() + borderWidth; final int height = bitmap.getHeight() + borderWidth; Bitmap canvasBitmap = Bitmap

Glide not updating image android of same url?

别来无恙 提交于 2019-12-21 06:51:14
问题 I have the same url for an image. When I update this image more than one time it shows the previous image. The image and picture version on the server is updated but Glide is not showing the new image.I want to get new image every time and cache it . Glide.with(context) .load(Constants.COPY_LINK_BASE_URL + info.getDisplayPicture()) .placeholder(R.drawable.ic_profile).dontAnimate() .diskCacheStrategy(DiskCacheStrategy.SOURCE) .signature(new (SettingManager.getUserPictureVersion(context)))

ViewPager with ImageView gives “java.lang.OutOfMemoryError: bitmap size exceeds VM budget”

自闭症网瘾萝莉.ら 提交于 2019-12-21 06:45:17
问题 I made a ViewPager to display images. When I advance some pages I get an java.lang.OutOfMemoryError: bitmap size exceeds VM budget error. There are more questions about this issue but I did not find the solution ( BitMap.Recycle , System.gc() etc). If you have a suggestion or solution please let me know! The PNG's are 628KB, 478KB, 587KB, 132KB, 139KB, 149KB, 585KB (crash). If you have an other solution (scroll images like pages) for me let met know! My code: package nl.ipear.vngmagazine;

How can I make sine wave on an Imageview in android?

半世苍凉 提交于 2019-12-21 06:36:26
问题 I want to create image similar to this. Is it possible to be done in XML? If not, how would I scale an image that is shape like this? 回答1: Yes it's possible , you can use vactor drawable for it <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="640dp" android:height="640dp" android:viewportWidth="640" android:viewportHeight="640"> <path android:fillColor="#000000" android:fillAlpha="0" android:strokeColor="#000000" android