Skip to main content

Posts

Showing posts from March, 2019

Linear Layout in Android - ABNHive

Linear Layout arranges other views either horizontally in a single column or vertically in a single row. It arranges its elements sequentially Attributes android: orientation —Used for arranging the controls in the container in horizontal or vertical order android:layout_width —Used for defining the width of a control android:layout_height —Used for defining the height of a control android:padding —Used for increasing the whitespace between the boundaries of the control and its actual content android:layout_weight —Used for shrinking or expanding the size of the control to consume the extra space relative to the other controls in the container android:gravity —Used for aligning content within a control android:layout_gravity —Used for aligning the control within the container Example <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_widt

An Introduction to Layouts in Android - ABNHive

There is a number of Layouts provided by Android which you will use in almost all the Android applications to provide a different view, look and feel. Linear Layout - LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. Linear layout is used to place one element on each line. So, all the elements will be placed in an orderly top-to-bottom fashion. Relative Layout - RelativeLayout is a view group that displays child views in relative positions. Using relative layout, we can specify the position of the elements in relation to other elements, or in relation to the parent container. Table Layout - TableLayout is a view that groups view into rows and columns.  Absolute Layout - In AbsoluteLayout we can specify the exact coordinates of each control that we want to place. In absolute layout, we will give the exact X and Y coordinates of each control. Frame Layout - It is used when you want to show one item on each screen. Li