Android TutorialsNo Comments

133
559 views.

An Absolute Layout lets you specify exact locations (x/y coordinates) of its children. Absolute layouts are less flexible and harder to maintain than other types of layouts without absolute positioning.

Note: Now this became deprecation so we are not using now.

133

AbsoluteLayout Attributes
Following are the important attributes specific to AbsoluteLayout –

android:id This is the ID which uniquely identifies the layout.
android:layout_x This specifies the x-coordinate of the view.
android:layout_y This specifies the y-coordinate of the view.

MainActivity.xml

Following will be the content of res/layout/activity_main.xml file −

Following will be the content of res/values/strings.xml to define two new constants −

Let’s try to run our modified Hello World! application we just modified. I assume you had created your AVD while doing environment setup. To run the app from Android Studio, open one of your project’s activity files and click Run   icon from the toolbar. Android Studio installs the app on your AVD and starts it and if everything is fine with your setup and application, it will display following Emulator window −

12

Be the first to post a comment.

Add a comment