imageview

Change image to a picture in Gallery

試著忘記壹切 提交于 2019-12-12 03:45:26
问题 I am working on an application that needs to obtain a random picture from the android device's built-in picture gallery and then display it on the screen. Here's what I have to work with: -An ImageView object called picture -The ID, TITLE, DATA, MIME_TYPE, and SIZE of the picture I want to display I think the problem is I don't know what information I need to put in this line: picture.setImageResource(???); Here's all my code to give you some idea of what I'm trying to do: public void

draw square 3x3 cm in Android

℡╲_俬逩灬. 提交于 2019-12-12 03:43:55
问题 I need to draw an exact square 3x3 cm on the screen, you need the exact dimensions in any type of screen as design work. The result in a Samsung Ace is 2.8 cm, the result is not exact. Java... DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); float ld = 30 * metrics.densityDpi * (metrics.density/25.4f); bitmap = Bitmap.createBitmap((int) ld, (int) ld, Bitmap.Config.ARGB_8888); canvas = new Canvas(bitmap); paint = new Paint(); paint

ImageView coordinate (0,0) has space

时光毁灭记忆、已成空白 提交于 2019-12-12 03:24:34
问题 Im facing the next problem: I have an imageView that change the size programmatically because de density hdpi has a 480x800 resolution. I change the size with layoutParams. After I change the size, I want to position the imageView. When I position the view for example to the coordinate (0,0) I saw that between the imageView and the limit of the screen is a little space, like 25 inches. The imageView moves to other place and when I want to position it again to (0,0), the space between the

Select Image From Gallery And Display It On ImageView, Issue On Nexus 5

拟墨画扇 提交于 2019-12-12 03:23:10
问题 I have a very weird issue, I want the user to select an image and display it on a ImageView, the code works perfectly on my Xiaomi mi52 (V4.1.1) and my Xiaomi MiPad (V4.4.4) but it's totally failed on my Nexus 5 (V5.0). public class CreateContactActivity extends Activity { private ImageView imgProfile; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_contact); imgProfile = (ImageView)findViewById(R.id

Empty space above ImageView

空扰寡人 提交于 2019-12-12 03:20:03
问题 I got a static ImageView above a listView. But the imageView is showing some empty space above it. How can i remove this empty space? -when i use the the image as background of a TextView its perfectly alligned at parent top Here is my xml for the ImageView: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="

Android. How to move the imageview(set position/margin) when it is created

假如想象 提交于 2019-12-12 03:08:29
问题 I want to put some images in an area at the application start. As the number of images is not a fixed amount, so I have to create images dynamically. I want to set the position/margin of every images while they're created for good balance. I have tried follows, but there is no efficacy. ・After Created, use imageview.layout(). ・Use LayoutParams.margins(). ・Use AsyncTask to set margins. ・activity.runOnUiThread(). This is the code: // After access server, if needed then add a imageview to the 'c

Android display images from url in listview

天大地大妈咪最大 提交于 2019-12-12 03:07:33
问题 I want to display images in my app, I get the urls of this images from a mysql databse. Currently it only displays the urls of the images as text How can I download the images and display them in the listview? /** * Retrieves recent post data from the server. */ public void updateJSONdata() { // Instantiate the arraylist to contain all the JSON data. // we are going to use a bunch of key-value pairs, referring // to the json element name, and the content, for example, // message it the tag,

Android Image is seen/not seen when orientation is changed

邮差的信 提交于 2019-12-12 03:05:11
问题 I'm having some problems with ScrollView and an ImageView . What I want is: I have an ImageView set always at the top of the screen. Then, I have an ScrollView where go all elements of the View , and inside it I have another ImageView which it is set at the bottom of the screen when previous elements don't fill screen (usually Big Screens), and it is set at the bottom of the ScrollView when exists Scroll. It is ok for some other Activities I have, but I have some problems in one Activity that

Android Gallery - Using TextView and ImageView doesn't work?

非 Y 不嫁゛ 提交于 2019-12-12 02:53:27
问题 I have a Gallery with ImageViews and I want to make a text appear under each of them. My code doesn't work and I don't know why. I am not so advanced in Android programming so an edited Code response will be truly helpful. I also have a memory error when I fast scroll from the first image to the last one. P.S: I have tried many stackoverflow similar topics but none of them has worked for me. public class ImageAdapter extends BaseAdapter { int mGalleryItemBackground; private Context mContext;

Custom ImageView, keep state after resize

南笙酒味 提交于 2019-12-12 02:52:17
问题 I implemented a Custom ImageView based on Nicolas Tyler's post here: https://stackoverflow.com/a/17649895/680488 It works really good but I have one problem: I have the custom ImageView inside a layout with one other layout below the ImageView. This second layout's visibility can be toggled by the user. Whenever this happens, the ImageView gets resized (to fill the whole activity or make space for the other layout). So far so good. The problem is, that when this re-sizing occurs, the