imageview

setColorFilter not working

别等时光非礼了梦想. 提交于 2019-12-17 16:01:07
问题 I'm trying to implement a simple colorfilter on an imageview to turn the black image into a white image. In order to achieve that I do the following: weatherImg.setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY); weatherImg.setImageResource(R.drawable.b_clouded_rain); I've also tried to change to color in the color filter to red and white but all of them have no effect, what am I doing wrong? 回答1: As much as I hate to answer my own questions I found the problem: I should've used:

how to get color at the spot(or pixel) of a image on touch event in android

为君一笑 提交于 2019-12-17 15:36:40
问题 I want to get the color of the spot or pixel where I will touch a image in Android. I searched a lot on net, but got nothing. Please anyone help me. 回答1: try this: final Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap(); imageView.setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event){ int x = (int)event.getX(); int y = (int)event.getY(); int pixel = bitmap.getPixel(x,y); //then do what you want with the pixel data, e.g int

Android ImageView scale smaller image to width with flexible height without cropping or distortion

删除回忆录丶 提交于 2019-12-17 15:14:28
问题 Often asked, never answered (at least not in a reproducible way). I have an image view with an image that is smaller than the view. I want to scale the image to the width of the screen and adjust the height of the ImageView to reflect the proportionally correct height of the image. <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" /> This results in the image centered at its original size (smaller then the screen width) with margins at the side. No good. So I

How to show imageView full screen on imageView click?

 ̄綄美尐妖づ 提交于 2019-12-17 10:22:39
问题 I am getting images from url and showing it on the imageView. This functionality is working properly. But I want that when I click on that image, then it must be full screen. So how to achieve this functionality? I know I am missing something. Please help me. Screenshot is attached. I want the same functionality in my app also. Here is my code, which I am trying on Image click: @Override public void onClick(View v) { if (isTouch1) { horizontalScrollView.setVisibility(View.GONE); isTouch1 =

Android imageview not respecting maxWidth?

牧云@^-^@ 提交于 2019-12-17 10:19:14
问题 So, I have an imageview that should display an arbitrary image, a profile picture downloaded from the internet. I want this the ImageView to scale its image to fit inside the height of the parent container, and a set max width of 60dip. However, if the image is tall ratio-wise, and doesn't need the full 60dip of width, the ImageView's width should decrease so the view's background fits snugly around the image. I tried this, <ImageView android:id="@+id/menu_profile_picture" android:layout

Get Image from the Gallery and Show in ImageView

拈花ヽ惹草 提交于 2019-12-17 09:35:43
问题 I need to get an image from the gallery on a button click and show it into the imageview. I am doing it in the following way: btn_image_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getImageFromAlbum(); } }); The method Definition is as: private void getImageFromAlbum(){ try{ Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); }catch(Exception

View Pager + ImageView +Pinch Zoom + Rotation

我们两清 提交于 2019-12-17 08:53:11
问题 I want to implement Pinch Zoom on Imageview, with in View Pager similar to Default Android Gallery. I have found multiple source over GitHub, But the zoom and sliding just work for only first image. What I have tried: 1.) TouchImageView 2.) PhotoView 3.) Android Touch Gallery All the above links works fine for single image view. But when it comes to Images in View pager, They have some glitches and only works fine for first image in the View Pager. When we scroll over to 3rd 4th image in view

How to align TextView around an ImageView?

孤街醉人 提交于 2019-12-17 08:50:12
问题 I am trying to align the TextView around ImageView. I am using the following code: private void createSpannableText(){ TextView myTextView = (TextView) findViewById(R.id.textView); SpannableStringBuilder builder = new SpannableStringBuilder(); builder.append(this.getText(R.string.loren__ipsum__max)); int lengthOfPart1 = builder.length(); builder.append(" "); builder.append(this.getText(R.string.lorem__ipsum)); Drawable d = getResources().getDrawable(R.drawable.myImage); d.setBounds(0, 0, d

Android Drop Shadow on View

痞子三分冷 提交于 2019-12-17 08:11:11
问题 I have done some extensive searching for code examples on this but cannot find anything. In particular, I am looking to add a shadow to a png drawable I am using in an ImageView. This png drawable is a rounded rect with transparent corners. Can somebody please provide a code example of how to add a decent drop shadow to a view either in code or XML? 回答1: You could use a combination of Bitmap.extractAlpha and a BlurMaskFilter to manually create a drop shadow for any image you need to display,

Resize image to full width and fixed height with Picasso

谁都会走 提交于 2019-12-17 05:40:21
问题 I have a vertical LinearLayout where one of the items is an ImageView loaded using Picasso. I need to rise the image's width to the full device width, and to display the center part of the image cropped by a fixed height (150dp). I currently have the following code: Picasso.with(getActivity()) .load(imageUrl) .placeholder(R.drawable.placeholder) .error(R.drawable.error) .resize(screenWidth, imageHeight) .centerInside() .into(imageView); Which values should I put into screenWidth and