imageview

Adding Fling Gesture to an image view - Android

房东的猫 提交于 2019-11-26 21:33:00
Okay I have been referencing the code here: Fling gesture detection on grid layout but just can not get it to work. In my main activity I have a simple image defined. I want to detect a fling on the image. Here is my code below. The onclick method at the bottom is empty. Is it because of this? I left it blank because in the other code sample its not what I want. I just want a simple toast to pop up saying fling right or fling left. public class GestureRightLeft extends Activity implements OnClickListener { ImageView peek; private static final int SWIPE_MIN_DISTANCE = 120; private static final

Resize image to full width and fixed height with Picasso

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 21:26:15
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 imageHeight (=150dp)? You are looking for: .fit().centerCrop() What these mean: fit - wait until the ImageView

Android ImageView adjusting parent's height and fitting width

£可爱£侵袭症+ 提交于 2019-11-26 21:24:18
Update : I solved this issue by using the method described in this answer I'm a bit stuck with this issue, which I think should be pretty simple. So my app downloads an image, and renders the bitmap in an ImageView, a child element of a RelativeLayout. I would like the ImageView to fit the parent width, and to adapt it's size to keep the aspect ratio. Here is my XML : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" >

ScrollView not Scrolling - Android

…衆ロ難τιáo~ 提交于 2019-11-26 21:16:49
问题 I can't understand why this is happening. I am unable to scroll my scrollview. It has a textView, an imageview and few linear layouts inside of it. When I replace the imageview and linear layouts with textview it is working. This is really unusual and frustrating. Can anyone help me? Here is my code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" >

Android — How to position View off-screen?

百般思念 提交于 2019-11-26 21:15:15
I'm trying to animate a simple ImageView in my application and I want it to slide in from the bottom of the screen and come to a resting position where the top 50px of the view is off the top of the screen (e.g. the final position of the ImageView should be -50px in X). I've tried to use the AbsoluteLayout to do this, but this actually cuts off the top 50px of the ImageView such that the top 50px is never rendered. I need to have the top 50px of the ImageView visible/rendered while it's animating and then simply have it come to a rest slightly off-screen. I hope I've explained that well enough

SimpleCursorAdapter how to show an image?

故事扮演 提交于 2019-11-26 21:05:32
问题 I am making an android recipes application where i use a database. In database there is a column named" "images", where i store the name of the file of the picture of the recipe where i store at drawable folder. Now i want to make a List with the recipes, showing: 1) the Title of the recipe 2) a short description and 3) an image of the recipe To do that i use a Simplecursoradaptor. My problem is i can not show the image. I want to read the file name from the column "images" and then set the

Get the touch position inside the imageview in android

不问归期 提交于 2019-11-26 20:48:56
I have a imageview in my activity and I am able to get the position where the user touch the imageview, through onTouchListener. I placed another image where the user touch over that image. I need to store the touch position(x,y), and use it in another activity, to show the tags. I stored the touch position in the first activity. In the first activity, my imageview at the top of the screen. In the second activity its at the bottom of the screen. If I use the position stored from the first acitvity, it place the tag image at the top, not on the imageview, where I previously clicked in the first

Android Drag and drop images on the Screen?

随声附和 提交于 2019-11-26 20:32:20
I m working on project user to move the image in one position to Another position on the screen. I have written a sample code to move the image but the problem here is if I move one image the neighbouring image also starts moving.. Here is the sample code.any one Idea of this. Main.java public class MainActivity extends Activity { int windowwidth; int windowheight; ImageView ima1,ima2; private android.widget.RelativeLayout.LayoutParams layoutParams ; // private android.widget.RelativeLayout.LayoutParams layoutParams ; //private android.widget.RelativeLayout.LayoutParams layoutParams ;

I want to transfer the image from one activity to another

我怕爱的太早我们不能终老 提交于 2019-11-26 20:31:16
问题 I have to transfer the image from one activity to another. In first activity the user selects the image out of several images from scroll view and that image has to be displayed in the imageview of next activity. Help required. 回答1: In your first Activity Convert ImageView to Bitmap imageView.buildDrawingCache(); Bitmap bitmap = imageView.getDrawingCache(); Intent intent = new Intent(this, NewActivity.class); intent.putExtra("BitmapImage", bitmap); In second Activity Bitmap bitmap = (Bitmap)

How do you setLayoutParams() for an ImageView?

心不动则不痛 提交于 2019-11-26 20:02:05
I want to set the LayoutParams for an ImageView but cant seem to find out the proper way to do it. I can only find documentation in the API for the various ViewGroups , but not an ImageView . Yet the ImageView seems to have this functionality. This code doesn't work... myImageView.setLayoutParams(new ImageView.LayoutParams(30,30)); How do I do it? You need to set the LayoutParams of the ViewGroup the ImageView is sitting in. For example if your ImageView is inside a LinearLayout, then you create a LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(30, 30); yourImageView