imageview

Imageview issue with zoom in and out,drag with maximum and minimum levels

纵饮孤独 提交于 2019-11-30 16:56:40
I had implemented an image view with the zoom and drag functionalities.I am using matrix for the zoom and drag functionality.But my problem is that I cant set my minimum and maximum zoom level and the drag space limit.can any on e tell me how I can do that. private float spacing(MotionEvent event) { float x = event.getX(0) - event.getX(1); float y = event.getY(0) - event.getY(1); return FloatMath.sqrt(x * x + y * y); } private void midPoint(PointF point, MotionEvent event) { float x = event.getX(0) + event.getX(1); float y = event.getY(0) + event.getY(1); point.set(x / 2, y / 2); } private

how to display external image in android?

南楼画角 提交于 2019-11-30 16:19:35
问题 I want to display external image like: "http://abc.com/image.jpg" in my android phone application. can any one guide me how to achieve this? 回答1: There are many ways to achieve your request. Basically you have to download the image with an urlrequest and then using the InputStream to create a Bitmap object. Just a sample code: URL url = new URL("http://asd.jpg"); URLConnection conn = url.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new

how to display external image in android?

你离开我真会死。 提交于 2019-11-30 16:07:43
I want to display external image like: " http://abc.com/image.jpg " in my android phone application. can any one guide me how to achieve this? Francesco Laurita There are many ways to achieve your request. Basically you have to download the image with an urlrequest and then using the InputStream to create a Bitmap object. Just a sample code: URL url = new URL("http://asd.jpg"); URLConnection conn = url.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(bis); bis.close(); is

Displaying bitmap image in imageview by simple adapter

北战南征 提交于 2019-11-30 16:02:23
I am getting image from an url. I am using imageview in listview. I want to add the list of bitmap images into the each row of the list item. I used SimpleAdapter but the imageview shows blank.My code is below !! ArrayList<HashMap<String, Bitmap>> mylist = new ArrayList<HashMap<String, Bitmap>>(); Bundle bundle = this.getIntent().getExtras(); get = bundle.getString("name"); try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.propertyhookup.com/mobile/propertylist.php"); nameValuePairs = new ArrayList<NameValuePair>(1); nameValuePairs.add(new

Android Set ImageView image src in Style

我的未来我决定 提交于 2019-11-30 14:48:32
问题 I need to set the ImageView's src within my style, but I cant find a good example of anyone doing this and when I try the below code, it crashes the app. <ImageView android:src="@style/TitleBarImage"></ImageView> <style name="TitleBarImage"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:src">@drawable/whiteButton</item> </style> This should be simple. What gives? 回答1: Your xml is incorrect: <ImageView style="

drawable == drawable?

爷,独闯天下 提交于 2019-11-30 14:48:07
This is my problem...: In my activity I have an ImageView and a Button . I want the Button to perform an action ONLY when the ImageView displays a certain drawable. And yes, this means that the ImageView is animating between various drawables that is coded such that it does not interrupt with what I want done. ImageView imgview = (ImageView)findViewById(R.id.imgviewsid); Resources res = getResources(); Drawable acertaindrawable = res.getDrawable(R.drawable.thecertaindrawable); Drawable variabledrawable = imgview.getDrawable(); if (variabledrawable == acertaindrawable) { //does something } It

Pinch Zoom in android for an imageview?

試著忘記壹切 提交于 2019-11-30 14:43:25
I have one requirement in which i have to zoom in and zoom out images on pinch.. Please if anyone can suggest me pinch zoom functionality for Imageview.???? try this import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; public class MyImageView extends View { private static final int INVALID_POINTER_ID = -1; private Drawable mImage; private float mPosX; private float mPosY;

Android imageview shows greenish image

て烟熏妆下的殇ゞ 提交于 2019-11-30 14:19:13
This is the original image: This is the rendered image using ImageView: However, sometimes when the image is in a carousel, swiping back to the image may cause the image to render correctly, which is even more weird... This behavior is observed both on an LG G3 (Android 5.1) and Genymotion (Android 4.4.4). I'm using the Glide library for loading images, using the ARGB_8888 decode format: new GlideBuilder(this).setDecodeFormat(DecodeFormat.PREFER_ARGB_8888); This is a resolved issue 305 . Here is a quick recap: This issue appears only with images with JPEG format (the quality is irrelevant). It

Can I Add GIF format Image as a Splash Screen

血红的双手。 提交于 2019-11-30 14:08:58
问题 How can i add GIF format image as a splash screen. I tried to add but when i add it. It acts as a normal image. I don't know whether we can use Gif image as splash Screen. if there is any option to work that GIF format image. 回答1: Yes, you can Add Gif Image for the Splash Screen. To use Gif Image in your View. add this dependency to your build.gradle file in the app module. For the latest version. dependencies { compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.10' } and In the XML file

How to draw a circle after zoom in android

戏子无情 提交于 2019-11-30 14:04:43
问题 I am using Image view and drawing overlay image using layerDrawable. I have used two bitmaps original and myBitmap. After zoom I am not able draw circle in correct location, it's drawn in different location. This is the code I am using, ImageView view = (ImageView) findViewById(R.id.imageView); view.setOnTouchListener(this); Options options = new BitmapFactory.Options(); options.inScaled = false; original = BitmapFactory.decodeResource(getResources(), R.drawable.mainscreen,options); original=