imageview

Android Changing image size depending on Screen Size?

天涯浪子 提交于 2019-11-28 10:13:42
So I need to change the size of an image depending on the area of the screen. The image will have to be half of the screen height, because otherwise it overlaps some text. So Height= 1/2 Screen Height. Width = Height*Aspect Ratio (Just trying to keep the aspect ratio the same) I found something that was: Display myDisplay = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width =myDisplay.getWidth(); int height=myDisplay.getHeight(); But how would I change image height in java? or even XML if possible? I can't seem to find a working answer. You can do this

ImageView onImageChangedListener Android

Deadly 提交于 2019-11-28 10:05:38
Is there an onImageChangedListener() on a ImageView? I need the event when the image is changed from the ImageView. Check the imageview code in grepcode. You don't know when it is changed or redrawn. It is because after you setImageDrawable(), imageview will invalidate. At this time, the image IS NOT CHANGED correctly until ondraw is called. Anyway, why do you want to know the onimagechangedlistener? There is no default listener in Android .. but we can create the imagechange listiner .. copy the class and instead of using ImageView use MyImageView.. public class MyImageView extends ImageView

How can I show an image using the ImageView component in javafx and fxml?

拜拜、爱过 提交于 2019-11-28 10:05:10
I suppose it's a very simple thing but I just can't get behind it. All I want is to show an image over an ImageView linked to fxml. Here is my code: package application; import java.io.File; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; public class Main extends Application { @FXML private ImageView imageView; @Override public void start(Stage primaryStage) { try { AnchorPane root =

How to add a gradient to a ImageView nested in a CollapsingToolbar

谁说胖子不能爱 提交于 2019-11-28 10:00:07
I'am working on an Android app with material design. I have a detail view with a CollapsingToolbarLayout and a ImageView (works fine so far). Unfortunately the title is not readable if there is a bright image. So far I tried to add a gradient ( Add gradient to imageview ) but this solution didn't work for me because of the CollapsingToolbarLayout. Here you can see my code: <android.support.design.widget.CoordinatorLayout 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="match

How to display an image full size with ImageView?

邮差的信 提交于 2019-11-28 09:54:07
问题 I have problem when I try to display the image with full size. I tried to display image with wrap_content. But it is smaller real image. <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/screen1_logo" /> I go to the properties of this image and see some information: dimentions 211 x 74. Then I try to display image with fixed width and height. I see it's bigger. <ImageView android:layout_width="211px" android:layout_height="74px" android

What is the best way to apply color filter on hair style with some specified hair style image pattern?

。_饼干妹妹 提交于 2019-11-28 09:28:42
I am developing an android application for hair style salon.I am having two images. One is hairstyle (hair) and another is hair color pattern. I am able to change the color of hair style based on specific rgb value. My code is as below: int color = Color.rgb(182,132, 84); // getting rgb value Paint paint = new Paint(); paint.setColorFilter(new LightingColorFilter(color, 1)); transform.reset(); transform.postTranslate(-width / 2.0f, -height / 2.0f); transform.postRotate(getDegreesFromRadians(angle)); transform.postScale(scale, scale); transform.postTranslate(position.getX(), position.getY());

Android ProgressDialog with setContentView

喜你入骨 提交于 2019-11-28 09:23:58
I've read a hell of a lot about this, and can't see anyone who's done or tried it before. So I've got an object that extends ImageView, then within this I call a progress dialog and set the progress dialogs's content to the imageview (i.e. attempting to draw the progress dialog in the imageview..view.) loadingProgressDialog.setContentView(this); //this is: LoaderImageView extends ImageView loadingProgressDialog.setIndeterminate(true); loadingProgressDialog.show(); And I get the error: requestFeature() must be called before adding content Now I've seen this error before on loads of posts and

“The type Gallery is deprecated”, Whats the best alternative?

巧了我就是萌 提交于 2019-11-28 09:04:27
I was really surprised that such a Widget gets deprecated. I want a simple gallery that scrolls left and right, shows a picture on the whole Activity screen, and most important is that you cant swipe more than 1 image in any direction, even if the scroll speed is fast it changes to the next image. So which Widget should I use? Or should I use a simple ImageView and handle all the swipes and add an animation? It states in the docs: This widget is no longer supported. Other horizontally scrolling widgets include HorizontalScrollView and ViewPager from the support library. HorizontalScrollView

how to use correct dragging of a view on android

丶灬走出姿态 提交于 2019-11-28 08:49:41
it seems that there are a lot of solutions of how to use dragging of views on android . however, they are either too slow or buggy. a known solution is to have a framelayout , and the view simply changes its layoutParams as it moves using the OnTouchListener ,as described here: http://www.anddev.org/novice-tutorials-f8/android-drag-and-drop-of-normal-views-not-bitmaps-t13404.html however, if the view is an imageView , when reaching the most right (or most bottom) side of the framelayout , the image shrinks . another possible solution is to use the canvas in order to show the dragged content ,

add image to surface view in android

久未见 提交于 2019-11-28 08:49:38
I want to add image to Surface view. So i used below code public class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback{ Bitmap myicon; Canvas canvas; private Paint mBitmapPaint; Paint p= new Paint(); @Override protected void onDraw(Canvas canvas) { Bitmap myicon=BitmapFactory.decodeResource(getResources(),R.drawable.icon); canvas.drawColor(Color.BLACK); canvas.drawBitmap(myicon, 0,0, p); // canvas.drawBitmap(myicon, 0,0, null); // canvas.drawBitmap(myicon, 25,25, null); } public MySurfaceView(Context context) { super(context); // TODO Auto-generated constructor stub }