I was wondering if it's possible with Constraintlayout to achieve the following:
I have an Image with a fixed Ratio (2:1) and want it to overlay with a gradient, which should start from the bottom of the Image and top align it to 50% of the Image height.
As far as I could see it is not possible.
Using a Guideline does not work, as it can only be placed with Percentage to the Parent/Layout
Using weight
is only possible in Chains, but as I need to overlay both views chains cannot be used, right?
you can achieved this like below:
here imageView is set in 2:1 ratio and 2 extra view set in above Imageview where View_Top is transparent and View_Bottom is bottom half of imageview so you can set your gradient in View_Bottom.
In below image background color is gray and your color can replace in View_Bottom color