I need to make a mask on an HorizontalLinear Layout.
the mask must blear (sfumate) the layout at right and left.
In the layout i'have 5 picture, tha can scroll horizontally
Have any idea?
You an horizontal scroll view from devian Horizontal ListView in Android?.
For the dimming, this may be tricky, you could maybe just add some imageview to each side of the list, but you will have to re-implement it I think, not sure.
wrap the ImageView in a FrameLayout, when the mask should be shown, on FrameLayout.setForegroundDrawable(arg) . The 'arg' is drawable with a transparent color value.
Hope it helps.
Related
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 have a parent LinearLayout called ContainerLayout where I put 2 other LinearLayouts inside of it. The parent LinearLayout has rounded corners, so logically it has to sort of clip anything showing outside the rounded corners right ? Well, Android has another theory...
The ContainerLayout should have an outside border, not an inner one.
I wanna be able to hide any overflowing stuff outside of the ContainerLayout, the same we do in CSS if any of you are familiar with overflow: hidden. Thanks.
Add paddings to your ContainerLayout. In this case try 6 dp.
I have a layout with 2 ImageView, for example, a square(part 3) and a rectangle(part 1) as in the attached picture.
I want these ImageView has a clipped part in common ( part 2).
The problem is I must use the RelativeLayout ( for some other reasons).
So, I try to set alignParentLeft for both , and margin left/ margin right properties with hope that they will be clipped.
Any suggestion is appreciated.
Thanks.
I Need to shift an ImageView, which is a direct child of a LinearLayout, a bit to the left.
What happens: The View is shifted (can see the "bounding box" is shifted, with android layout manager) but the drawable keeps in the same place.
Also the drawable is cut on the right side, if I set margin low enough.
Why is this? Any advice?
Clarification: I have to shift the Image to the left. That means a bit ouside of the bounds of the containing layout.
It seems elements are always clipped when they get outside of parent's bounds (also with clipChildren=false).
A solution is to create an additional container-layout for everything besides of the item to be shifted. And then shift the container-layout in the opposite direction.
For example, to shift -10dip:
<Original container ...>
<Item to be shifted/>
<New container with margin 10dip>
<Previous content of Original container ... />
</New container with margin 10dip>
</Original container>
If your container have enough padding you can set its clipToPadding to false and use negative margin!
Why are you using negative margin? use a positive a bit more to the opposite side of the ImageView to the direction you want to shift the image, i.e. if you want to shift the image to the left, use more positive margin to the right.
I have a GridView populated with ImageButtons at runtime. Some buttons are smaller than others and they hug the top of their row; I want them centered in their row. I think I could accomplish this with a margin (or maybe even gravity) but programmatically I don't see any way to do this.
The usual advice is to use LayoutParams, but the layout params available via GridView's LayoutParams are very limited and don't include margin or gravity.
Thanks in advance for any suggestions!
If your images are a part of a linearlayout of any other layout view, on the image, you could use something like :
<View
android:gravity="center-vertical"/>
This will handle the view to be in the center of the vertical stretch. If you use :
android:layout_gravity
then it will position it according to its parent.