How to add ImageView in RelativeLayout with some coordinates, which is bigger than RelativeLayout Size?
Trouble is, when I add ImageView with padding left bigger then layout width, and use in that layout scrollTo(-100,0) (for example), I can't see nothing, my ImageView disappeared, or be smaller(when padding left a little less than layout width).
How can I turn off ImageView auto-scaling or something?
Related
I design a Android Layout where only a cropped part of an Image should be displayed within a frame. I do this with an ImageView within an RelativeLayout. The ImageView lies below the RelativeLayout and is larger than the RelativeLayout. The ImageView is set android:scaleType="centerCrop".
Now I need to shift the Image behind the Frame (the RelativeLayout) in order to display another part of it inside the Frame. How is this possible? A setY() on the ImageView shift the cropped Image, but the Image should first be shifted and cropped afterwards.
Have you tried paddingbottom for imageview?
paddingtop makes image to occupy less height and it gets center cropped in remaining portion
you can align you imageview with relative layout and can show rest of the view
I am using a ConstraintLayout with two views inside. An ImageView that varies in size depending on the image loaded and a View which acts as a custom made dropshadow for the Image. What I've been doing so far is adding 8dp padding to the ImageView and then aligning all of the edges of the View to the ImageViews, thereby making the View stick out 8dp underneath the ImageView.
Now for several reasons I don't want to keep the padding on the ImageView but I still want to achieve the same effect. So basically I would like to align the Left of the View to 8dp left of the Left of the ImageView (and the same for every other edge, right, top, bottom).
Is there any way to achieve this?
Thanks in advance!
I´ve been having problems with this too, it seems ConstraintLayout does not support negative margins yet: https://code.google.com/p/android/issues/detail?id=235306.
In my case, I want a 20dp negative margin to a set of overlapping images on a header image. So far, I'm positioning an empty TextView below the guideline my header image is connected to, with a 20dp top margin and aligning my overlapping image views to that.
I've often seen that I've you place an ImageView in a RelativeLayout in Android, and set its layout:width to match_parent, it won't size the image and make it bigger to fill the width, instead it show some white space besides the image. Why is that happening and how can I handle that?
I have a RelativeLayout with an ImageView (with match_parent as height and width). The ImageView has a scaleType of center_crop.
I programatically scale the RelativeLayout in the Y axis according to a specific gesture on the device. The RelativeLayout scales correctly, but the ImageView stretches instead of center_crops as expected. I assume this is because the ImageView is only centered and cropped in the start during the layout process. Is there anyway I can force the ImageView to recalculate the center_cropping process while the gesture is in motion?
I will appreciate any help. I can post more information and examples if my question isn't making any sense.
I have a RelativeLayout which I expand (vertically) when clicked on. This RelativeLayout have a background image. This is implemented by adding a ImageView to the RelativeLayout.
I want the Image (and ImageView) to be larger than the RelativeLayout, so when the RelativeLayout is expanded the background (ImageView) is not stretched but instead just showing a larger crop of ImageView.
I would really like to have a ImageView larger than the RelativeLayout and then just expand the RelativeLayout instead of changing the size of the ImageView when the RelativeLayout is expanded. The reason for this is that the expansion uses a smooth animation and changing the ImageView for each frame leads to a significant overhead since it resizes/crops the image for each frame to match the current size of the RelativeLayout.
Contained Views can't be bigger than their parents.
But the image in an ImageView can be bigger than the View.
Just don't set it as a background (which will be stretched), but as a src.
NO:
android:background="#drawable/my_bg"
YES:
android:src="#drawable/my_bg"
You can play with the scaleType attribute (http://developer.android.com/reference/android/widget/ImageView.ScaleType.html) for fine tuning