imageview

How to compare a String-Array

家住魔仙堡 提交于 2019-12-10 11:45:21
问题 Android devs! 1) I have tried to compare a string-array declared in my string.xml (I don't know if it's possible): <string-array name="menu_array"> <item>Pizzas</item> <item>Baguetes</item> <item>Calzones</item> <item>Esfihas</item> <item>Refrigerantes</item> <item>Vinhos</item> <item>Cervejas</item> </string-array> 2) I have a layout with an ImageView, to update images corresponding to each menu item string-array: <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android

Resize Images in Canvas

时光毁灭记忆、已成空白 提交于 2019-12-10 11:40:46
问题 I'm displaying a bitmap on Inside the ImageView and using the Canvas . ImageView : it display the whole image not matter how large the image, it compress bitmap within the width/height of Imageview. Canvas : canvas draw the bitmap but if the bitmap is larger it goes out of screen. How to same behavior for bitmap on canvas like Imageview display.? 回答1: To resize a bitmap take a look at drawBitmap method in the canvas, Each overloaded method allows you to specify a size. For example here is the

using ACTION_IMAGE_CAPTURE to take picture and setImageBitmap to display it

我的梦境 提交于 2019-12-10 11:31:50
问题 EDIT i updated the code to reflect changes suggested in both answers, unfortunately, now my app force closes. the error is listed at the bottom this is my camera/picture class in its entirety (except for import s) this class is supposed to take a picture, display it to the screen, and let another class have the string path of the picture for use as an attachment. it takes the picture fine, it emails the picture fine, but i cannot figure out how to make it display the picture after its taken.

Android 4.0 ImageView setImageBitmap does not work

落花浮王杯 提交于 2019-12-10 09:36:07
问题 I develop a App with ffmpeg to decode a media frame. I filled a Bitmap object with the decode result and use ImageView.setImageBitmap to display the bitmap. In Android 2.3 it works well, but in Android 4.0 or up it doesn't work. The code is simply : imgVedio.setImageBitmap(bitmapCache);//FIXME:in 4.0 it displays nothing Then I tried write the Bitmap to a file and reload the file to display. String fileName = "/mnt/sdcard/myImage/video.jpg"; FileOutputStream b = null; try { b = new

bottom margin or padding doesn't work in relative layout in xml on android

痴心易碎 提交于 2019-12-10 01:45:55
问题 I have a RelativeLayout for a row that goes inside a ListView . The row looks like, <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="fill_parent"> <ImageView android:id="@+id/placeDetailIcon_Img" android:layout_height="50dp" android:layout_width="50dp" android:layout_alignParentLeft="true" android:paddingBottom="20dp" android:paddingTop="20dp" android:paddingLeft="20dp"

How to center ImageView in a toolbar?

狂风中的少年 提交于 2019-12-10 00:55:24
问题 Been trying to center a logo inside my toolbar. When i navigate to the next activity, the "up affordance" icon is present, and it will push my logo slightly to the right. How can I keep my logo at the center of the toolbar, without removing the up affordance icon? This is my toolbar tag <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap

Set image from android.R.drawable in image view android

偶尔善良 提交于 2019-12-10 00:36:37
问题 i know how to set image/icon from our res/drawable <ImageView android:id="@+id/ImageSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/android_green_3d"/> If we set it directly from the code: imageView1.setImageResource(R.drawable.android_green_3d); But we can also get the icon from android.R.drawable like this: imageView1.setImageResource(android.R.drawable.ic_menu_more); How to set image/icon in xml id the source is android.R.drawable?

Car animation rotating wheels

£可爱£侵袭症+ 提交于 2019-12-09 23:45:53
问题 I am working in an app that shows different cars and the user needs to choose one. When you press on next the car moves out of the screen and the new one comes in. My resources are: Car's body Car's wheel (I need them to be separated because when the car moves I need to rotate the wheels) I wanted to avoid AbsoluteLayout so my CarView extends `RelativeLayout. Here's the code: public class CarView extends RelativeLayout { private ImageView mBody; private ImageView mLeftWheel; private ImageView

Image in ImageView is stretched - Android

让人想犯罪 __ 提交于 2019-12-09 19:47:16
问题 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

Add limit to zoom-in and zoom-out in android

大城市里の小女人 提交于 2019-12-09 13:56:09
问题 I have an imageview that can be zoomed. I have a code that works well, but my problem is that I want to add a limit for maximum and minimum zooming levels. import android.annotation.TargetApi; import android.app.ActionBar; import android.app.Activity; import android.graphics.Matrix; import android.graphics.PointF; import android.os.Build; import android.os.Bundle; import android.util.FloatMath; import android.util.Log; import android.view.MenuItem; import android.view.MotionEvent; import