imageview

Android ImageView setting Bitmap FitXY doesn't work

倖福魔咒の 提交于 2019-12-07 07:58:36
问题 I've been trying for a really long time to set the bitmap so it will fit the ImageView bounds. It just doesn't work via scaleType: fitXY . My bitmap images size are lower than the ImageView 's (Saved on 100X100 pixels), I want my bitmap images to fit and stretch into the ImageView . Here's some code: <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/imageView" android:layout_height="match_parent" android:layout_width="match_parent" android:src="@drawable

Android Translate Animation

試著忘記壹切 提交于 2019-12-07 06:54:57
问题 I have an ImageView that is 250dp above the bottom and with translate animation i want to move it to 50dp above the bottom. I know how to use a translate animation, but I don't know what would be the ToYValue field. The code wil be something like this: TranslateAnimation translate = new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0,Animation.RELATIVE_TO_PARENT,0,Animation.ABSOLUTE,250,Animation.ABSOLUTE,50); translate.setDuration(1000); translate.reset(); translate.setFillAfter(true); iv

How to find intersect between two ImageView when drag and drop?

泪湿孤枕 提交于 2019-12-07 04:17:12
问题 I have two ImageView One is fixed at a position On Second I need to apply drag an drop functionality. What I need: Drag second ImageView to the another ImageView and when they intersect than I need to call a method. EDIT 1: Intersect b/w two imageView is DONE but on the drag n drop it's not happening. Edit 2 : How can I achieve this thing on Drag and drop ? 回答1: I assume that you need this functionality for Android. The easiest way is to use intersects method found in Rect class. Link to

Rotating ImageView and its background without crop

丶灬走出姿态 提交于 2019-12-07 03:27:34
问题 I've been searching a lot, but I can't get a solution for my problem. I can't use android:rotation as I want this app to be compatible with Android API under 11 version. My problem is something similar to this: Rotating a view in Android I've done this: @Override public void draw(Canvas canvas) { canvas.save(); Drawable d = getDrawable(); canvas.rotate(-10, d.getIntrinsicWidth() / 2, d.getIntrinsicHeight() / 2); super.draw(canvas); canvas.restore(); } The ImageView is part of a RelativeLayout

Center drawable and scale height

核能气质少年 提交于 2019-12-07 00:58:31
Since I want to support tablets and smartphones without delivering a special "HD" version, I need to scale my Images depending on the resolution of the users device. This is the ImageView source that looks good on the Samsung Galaxy Nexus: <ImageView android:id="@+id/character" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@android:color/transparent" android:scaleType="centerCrop" android:src="@drawable/ma_un1_001" /> But it will cut the image on the nexus 7. When I

Load image from URL

空扰寡人 提交于 2019-12-07 00:49:29
I've searched and tried a couple different methods. I am coming up short on both. This is my current method: package com.dop.mobilevforum; import java.io.InputStream; import java.net.URL; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; import android.widget.VideoView; public class Vforum extends Activity { private String imgPath = "http://mysite.com/mv/vfdemo1/slides/slide1.jpg"; private

ImageView won't show image when set by setImageBitmap()

孤人 提交于 2019-12-07 00:47:09
问题 I am having problems getting an existing image on the sdcard to display. ImageView _photoView = (ImageView)findViewById(R.id.img_photo); File photoFile = new File(Environment.getExternalStorageDirectory(), Session.PHOTO_FILE_NAME); rawFileInputStream = new FileInputStream(photoFile); Bitmap origPhoto = BitmapFactory.decodeStream(rawFileInputStream, null, new BitmapFactory.Options()); _photoView.setImageBitmap(origPhoto); Log.d(TAG, origPhoto.getWidth() + " - " + origPhoto.getHeight()); The

file path return null always in lollipop android

懵懂的女人 提交于 2019-12-06 21:56:24
问题 this is my code when i'm getting image from internal storage (gallery). In lollipop file path return always null. if (requestCode == PICK_IMAGE) { if(resultCode == RESULT_OK){ //image successfully picked // launching upload activity Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null); cursor.moveToFirst(); columnindex = cursor.getColumnIndex(MediaStore.Images

Tinting ImageView not working on Android 5.0. Ideas how to make it work again?

别来无恙 提交于 2019-12-06 20:56:37
问题 In an application I've built I noticed that the ImageViews are not tinted on devices running the new Android Lollipop. This is the code that used to work correctly on older versions of the OS: <ImageView android:layout_width="40dp" android:layout_height="40dp" android:layout_gravity="bottom|right" android:contentDescription="@string/descr_background_image" android:src="@drawable/circle_shape_white_color" android:tint="@color/intent_circle_green_grey" /> and this is the drawable that is loaded

Getting black ImageView using Picasso and Glide

喜欢而已 提交于 2019-12-06 16:30:02
问题 The problem I'm writing an Android app that's supposed to have a "Slideshow" feature on it. I've found this nice library, based on Picasso, that does exactly what I wanted, and it worked just fine most of the times. Problem is, sometimes my images are not loaded into the slide ImageView ... It only shows a "black canvas" as you can see on the screenshot below. I am loading the image from a local resource from my drawables. Sometimes it happens on Portrait mode, sometimes on Landscape mode. It