When using a RelativeLayout, you can use these attributes to describe how you want to position each View. Each one of these attributes defines a different kind of relative position. Some attributes use the resource ID of a sibling View to define its own relative position. For example, the last Button is defined to lay to the left-of and aligned-with-the-top-of the View identified by the ID ok (which is the previous Button).
3.) Make sure you load this layout in the onCreate() method:
On Clicking Finish MyFirstRelativeLayout code structure is generated with the necessary Android Packages being imported along with MyFirstRelativeLayout.java.
Output –The final output:
Here in this example we can manipulate the view as per our requirement i.e. if we want to adjust the size of button as per the length of button label then it will work. We can use the space as we need.