imageview

Repeat drawable in imageview?

风格不统一 提交于 2019-11-27 23:36:50
问题 Is it possible to repeat a drawable in an ImageView? I manage to repeat my drawable as a divider in a ListView, but not as an ImageView. Here is my repeated image definition: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/xdividerrepeat" android:tileMode="repeat"/> Thanks Markus 回答1: You could use a "dummy" view like a LinearLayout to accomplish this. Just create a LinearLayout with the size you need and set its background drawable to be your

How to show an image from an url in android

好久不见. 提交于 2019-11-27 23:21:35
I have looked around the internet but haven't been able to find a working example on how to show an image from an url. The below code is crashing and I can't find out why.. Any help is greatly appreciated. Thanks. TesteImages.java: package pac.image3; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.widget.ImageView; public class TestImages extends Activity { /** Called when the activity

take picture from camera and choose from gallery and display in Image view

跟風遠走 提交于 2019-11-27 23:20:56
I want to take photos from gallery and set it in my ImageView as well as I want to take photo from camera and set it into my same Image View. I am very much stuck on this. Can anyone help me? Thanks. Shafi You can handle your camera view click this way: cameraImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); startActivityForResult(intent, 0); } }); Do this in your activity when you return after capturing image. @Override protected void onActivityResult(int requestCode, int resultCode,

ScrollView not Scrolling - Android

僤鯓⒐⒋嵵緔 提交于 2019-11-27 23:02:23
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" > <ScrollView android:id="@+id/scrollView1" android:layout_width="match_parent" android:layout_height=

How to write Text on ImageView in android coding?

这一生的挚爱 提交于 2019-11-27 22:58:31
Hi I've been trying to write Numbers on Imageview. Images for N number of questions. If the user entered answer is correct, then it should be displayed with question number with tick mark image else question number with wrong mark image. I need to write the question number on the image. My code is here: LinearLayout l_layout = (LinearLayout) findViewById(R.id.linear_view_report); LayoutParams param = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f); ImageView[] imgview=new ImageView[questions.length]; for(int i=0;i<no_of_questions;i++) { if

Move imageview after animation (update position)

假装没事ソ 提交于 2019-11-27 22:46:31
问题 I am trying to to do a translate animation on an image view from the bottom to the middle of the screen. Upon finish of the animation, I want the image view to stay there. I dont want the setFillAfter(true) because I want the actual position of the imageview to be updated. I do it currently by having 2 image view (one at the start of animation and one at the end) and I play with the setVisibility to achieve this. Is this the correct way to do things? Here is the code I used: <ImageView

SimpleCursorAdapter how to show an image?

流过昼夜 提交于 2019-11-27 22:37:28
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 image at my imageview (R.id.imageview1) Here is my code untill now: public class RecipesMainActivity

galaxy s4 and maybe all HD phones? out of memory error inflating layout

二次信任 提交于 2019-11-27 21:51:01
问题 So this app I am working on, works just fine on a really old miserable Android 2.3.3 phone. However when running it on the GS4, the GS4 is throwing out of memory exceptions every time is has to load a resource from the drawables, that is predefined in the xml. <ImageView android:id="@+id/ivLearnMore" android:layout_width="match_parent" android:layout_height="200dp" android:layout_weight="1" android:scaleType="fitCenter" android:src="@drawable/learn_more" /> For example this Imageview will

How do I resize an imageview image in javafx?

£可爱£侵袭症+ 提交于 2019-11-27 21:50:52
I need to resize an image to specific dimensions, 100 by 100 pixels for example, in JavaFX. How can I achieve that? Could the Image or the ImageView class be used for this purpose? James_D Yes, using an ImageView . Just call ImageView imageView = new ImageView("..."); imageView.setFitHeight(100); imageView.setFitWidth(100); By default, it will not preserve the width:height ratio: you can make it do so with imageView.setPreserveRatio(true); Alternately you can resize the Image directly on loading: Image image = new Image("my/res/flower.png", 100, 100, false, false); Resizing the image on

How to draw a Line in ImageView on Android?

你离开我真会死。 提交于 2019-11-27 21:34:29
I'd Like to know how to draw a Line on ImageView as user swipe their finger ? Could any body explain this ? Or perhaps any Link to get start on this. You must have your own ImageView and override onDraw function. Use something like this public class MyImageView extends ImageView{ public MyImageView(Context context) { super(context); // TODO Auto-generated constructor stub } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); canvas.drawLine(0, 0, 20, 20, p); } } and in your main class create object MyImageView ; and when you touch