imageview

set source of ImageView dynamically android

走远了吗. 提交于 2019-12-04 19:28:43
问题 I have an ImageView on my scene that I would like to set the source of dynamically based on user input. Let's say I have 4 images in my drawable folder: aaa.png, bbb.png, ccc.png, and ddd.png. When my application loads I set the image to: aaa.png myImageView.setImageResource(R.drawable.aaa); now I have an EditText where a user can type in bbb and I want to change the image source to be the bbb.png, or user enters ccc, change source to ccc.png etc. how can I dynamically set the parameter in

Android center Bitmap in ImageView matrix

落花浮王杯 提交于 2019-12-04 18:56:50
I am working on an app where user can move his image within the screen, and then save it. The problem is positioning Bitmap in ImageView on start of the activity. Here is the XML: <RelativeLayout android:id="@+id/image_content_holder" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/top_image" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:scaleType="matrix" android:gravity="center|center_vertical" android:layout_gravity="center|center_vertical"/> </RelativeLayout> I am

Android how do I zoom and scroll a bitmap which is created on the fly

拜拜、爱过 提交于 2019-12-04 18:56:44
In my application, i'm using the following code for holding a map which is downloaded from a server. <?xml version="1.0" encoding="utf-8"?> <ScrollView android:id="@+id/scrollView1" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_gravity="center" android:layout_weight="1.0"> <ImageView android:id="@+id/mapImageView" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_width="wrap_content" android:scaleType="center"/> </ScrollView> currently, i can scroll the image up and down only. I need to have the ability to scroll

Change the size of ImageView on zooming

血红的双手。 提交于 2019-12-04 18:15:16
问题 I am using chrisbanes PhotoView to implement pinch zoom..Image zooms on pinching and double tapping but i can't see that my image streched to full screen on zooming..on zooming it looks that image zooms inside a box and part of image disappears on zooming...How can i implement image zoom so that height of Image increases on zooming?I am using NetworkImageView ( of Volley library). NetworkImageView imageView; PhotoViewAttacher mAttacher; imageView = (NetworkImageView) mImgPagerView

Android : load an imageview from a Parsefile

最后都变了- 提交于 2019-12-04 18:14:45
I'm trying to find a ParseObject by " objectId ", then retrieve the image " ImageFile " and then Load it to the imageview, it doesn't work and i'm getting the USER String, can you help me out with this, it works when i use another query like : query.find() ParseImageView mealImage = (ParseImageView) findViewById(R.id.icon); ParseQuery<ParseObject> query1 = ParseQuery.getQuery("Annonces"); query1.getInBackground("ux3Af0cwEx", new GetCallback<ParseObject>() { public void done(ParseObject Annonces, ParseException e) { photoFile = (ParseFile) Annonces.get("ImageFile"); text1.setText((CharSequence)

Button like click effect for Imageview in android

情到浓时终转凉″ 提交于 2019-12-04 17:23:48
I'm having an imageview which will navigate to another page once it is clicked. Right now when it is clicked user will not be getting any feel that it is clicked. So what i want is to have some effect (like in normal button) at the time of click on the image....can anyone help me? Try a selector like this <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"><shape> <solid android:color="#151B8D" /> <stroke android:width="1dp" android:color="#151B8D" /> <corners android:bottomLeftRadius="8dp" android

How to take screenshot for Android Surface view

帅比萌擦擦* 提交于 2019-12-04 17:10:43
I'm try to implement Take a Screenshot form my camera Surface view through code. I able to do of those things, however the screenshot always appears black. Here is the Code. i have searched many links and implement my code. but still screenshot appear black. how to resolve this. please guide me. thanks public class Cam_View extends Activity implements SurfaceHolder.Callback { protected static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 0; private SurfaceView SurView; private SurfaceHolder camHolder; private boolean previewRunning; final Context context = this; public static Camera camera =

how to set the bitmap to the ImageView in main.xml captured from the camera?

谁都会走 提交于 2019-12-04 16:25:28
问题 I have a Imageview in main.xml, how to set the bitmap the to the imageView in main.xml i can assign bitmap to the local image view in the below code. //Activates the Camera Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); startActivityForResult(intent, 1); // get the bitmap data from the Camera Bundle extras = data.getExtras(); Bitmap b = (Bitmap) extras.get("data"); int width = b.getWidth(); int height = b.getHeight(); ImageView img = new ImageView(this); img.setImageBitmap

Image in ImageView is stretched - Android

我是研究僧i 提交于 2019-12-04 16:05:11
I am trying to make a small image appear on my screen. I want it to be a small square. With the below code, it shows up as a long flat rectangle. I have attached a picture of what it looks like below. java code ImageView q1Image = (ImageView)findViewById(R.id.q1Image); q1Image.setScaleType(ScaleType.FIT_XY); xml code <TableRow android:id="@+id/row4" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" > <ImageView android:id="@+id/q1Image" android:layout_width="10dp" android:layout_height="10dp" android:layout_weight=".1" android:textSize="8sp" android

Open full Screen Image when clicked on grid view android

房东的猫 提交于 2019-12-04 14:37:00
问题 // This is my On click function which opens New activity for image view. @Override public void onClick(View v) { Intent intent = new Intent(activity, ImageDisplayActivity.class); intent.putExtra("id", position+1); Below i'm getting the path of the file which is clicked. intent.putExtra("position", String.valueOf(getItem(position))); Log.d("ImageAdapter","Intent.putExtra "); activity.startActivity(intent); } This is my ImageDisplayActivity class. protected void onCreate(Bundle