imageview

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

∥☆過路亽.° 提交于 2019-12-04 14:34:34
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 imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new

DrawText on imageview

六眼飞鱼酱① 提交于 2019-12-04 14:27:30
问题 I tried to write the text in this way but it does not work and I do not understand where I'm wrong. mImageView.buildDrawingCache(); Bitmap bmap = mImageView.getDrawingCache(); Canvas c = new Canvas (bmap); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Style.FILL); paint.setTextSize(20); c.drawText("Some Text", 0, 25, paint); I tried several times but the display can not display any text. I have to make sure that this image is then saved with the written text. thanks 回答1

Android: Change text within ViewPager

女生的网名这么多〃 提交于 2019-12-04 14:22:54
问题 Background I'm writing an app that uses the ViewPager and that's working nicely. I need to be able to target one of the layouts (xml file) and update the textviews and imageviews on it. I've tried inflating the view and targeting with "v.findViewById", which seems to be the solution from my research but maybe I'm putting it in the correct place and need it explained better to me. My Code (without trying to target) private ImageView circle; @Override public void onCreate(Bundle

How to make smooth frame animation in android?

跟風遠走 提交于 2019-12-04 13:51:40
问题 I made a frame animation. But the transitition between images is bad looking. How can I apply a crossfade effect to it ? When using TransitionDrawable i get the proper result but it stops after one execution. Any one has an idea how to resolve it? public void startAnimation() { if (logoAnimation != null) { if (logoAnimation.isRunning()) { logoAnimation.stop(); } logoAnimation.start(); } } private int setLogoAnimation(int animationID, int targetID) { imageView = (ImageView) window.findViewById

Android ImageView topCrop/bottomCrop scaletype?

旧巷老猫 提交于 2019-12-04 13:12:27
I have a square ImageView which displays pictures of varying dimensions. I want to always maintain the original aspect ratio of the pictures and have no margin around the image (so that the image takes up the whole ImageView). For this, I am using the centerCrop scaleType on the ImageView . However, I want to make it so that if the top and bottom of the image are cut off (i.e.: the image is taller than it is wide), the image gets pulled towards the bottom of the container. So instead of having equal amounts of pixels cropped at the top and bottom, the image is flush with the top and sides of

Double-tap to zoom and pinch to zoom on ImageView in android

…衆ロ難τιáo~ 提交于 2019-12-04 12:15:53
问题 I was looking for iphone like tap and pinch zooming with android ImageView. Mike Ortiz have done some excellent work on TouchImageView to detect boundaries. His code can be found here. This code is missing only one thing, i.e., double-tap to zoom. Can anyone help add this feature to Mike Ortiz code? 回答1: Pinch Zoom on ImageView in Android with Orientation handling import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix;

Ripple effect in pressed state + transparency in normal state

隐身守侯 提交于 2019-12-04 12:11:19
I would like the ImageView in the ViewGroup, when pressed, draws the ripple and this is working ! But when the ViewGroup is pressed, the ImageView inside it, should remain transparent otherwise the ImageView background is visible: (that color alpha-orange, you actually see, is the ripple when pressed). This happens only with devices API 21+. With devices API <21 I use a selector and the image background remains transparent as wanted when the ViewGroup is pressed. layout.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/item_detail_field" android

Activity runs slow with a couple of ImageView-s

孤者浪人 提交于 2019-12-04 11:46:40
问题 I have an activity containing 4 images in total. They are all matching the resolution of a 1080x1920 device. When I run the activity with those images, which are loaded directly in my activity via the XML, it runs tremendously slow in my Genymotion emulator and lags on a real Android device. Here is the setup: <android.support.design.widget.AppBarLayout ...> <android.support.design.widget.CollapsingToolbarLayout ...> <LinearLayout android:layout_width="match_parent" android:layout_height=

Android pinch zoom large image, memory efficient without losing detail

好久不见. 提交于 2019-12-04 10:53:33
问题 My app has to display a number of high resolution images (about 1900*2200 px), support pinch zoom. To avoid Out of memory error I plan to decode image to show full screen by using options.inSampleSize = scale (scale was calculated as Power of 2 as Document) (My view i used is TouchImageView extends of ImageView ) So i can quickly load image and swipe smoothly between screens(images). However, when i pinch zoom, my app loses detail because of scaled image. If i load full image, i can't load

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

与世无争的帅哥 提交于 2019-12-04 10:25:55
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_centerHorizontal="true" android:scaleType="centerCrop" /> Java Code : ImageView iconView = (ImageView)