I want to make the image sticky in the layout right end corner in axml.
-
2You are expected to try to **write the code yourself**. After [**doing more research**](https://meta.stackoverflow.com/q/261592/1011527) if you have a problem **post what you've tried** with a **clear explanation of what isn't working** and provide [a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Read [How to Ask](http://stackoverflow.com/help/how-to-ask) a good question. Be sure to [take the tour](http://stackoverflow.com/tour) and read [this](https://meta.stackoverflow.com/q/347937/1011527). – Jay Blanchard Jun 16 '17 at 15:34
1 Answers
EDIT
I Realize now OP needs Xamarin Android. This was written for Xamarin Forms. :)
Check this question as this is a possible duplicate: Set the absolute position of a view
--
Try an absolute layout.
<AbsoluteLayout>
<!--If You have other content, like a stacklayout, put it before the image (like below)-->
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1">
<!--Content Here -->
</StackLayout
<Image Source="YOUR IMAGE SOURCE" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="1,1,0.2,0.2" />
</AbsoluteLayout>
Let me explain how absolute layout kinda works.
So an absolute layout allows you to place things on top of each other (Or just set a static position).
Absolute Layout Bounds work as follows: (position X start, position Y start, Width, Height). So by typing (0,0,1,1), I'm telling it to start at 0,0, and the width and height should be the same size as the window. If I were to do (0.5, 0.5, 0.2, 0.2), then I'd be telling it to start half way down and half way from the left, and make the object 0.2 of the total window size.
Ref Documentation: https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/absolute-layout/
Hope this helps

- 804
- 6
- 18
-
-
-
@SudiptoSarkar Try checking these answers: https://stackoverflow.com/questions/38794796/whats-alternative-to-deprecated-absolutelayout-in-android https://stackoverflow.com/questions/3539349/alternative-to-absolutelayout-in-android – Gerrit Jun 16 '17 at 15:42
-
@SudiptoSarkar See also: https://stackoverflow.com/questions/3294590/set-the-absolute-position-of-a-view?noredirect=1&lq=1 – Gerrit Jun 16 '17 at 15:46