Points Covered
- Layout Type
- Observer and Observable Activity
- Click Listener
- MVC
- Material Design Components
- App Bar, Action Bar & Tool Bar
Layout Types
-
Linear Layout
LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally.
-
Relative Layout
RelativeLayout is a view group that displays child views in relative positions. -
Table Layout
TableLayout is a view that groups views into rows and columns. -
Absolute Layout
AbsoluteLayout enables you to specify the exact location of its children. -
Frame Layout
The FrameLayout is a placeholder on screen that you can use to display a single view. -
List View
ListView is a view group that displays a list of scrollable items. -
Grid View
GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. -
ConstraintLayout : ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way. it is similar to Relative Layout
-
Coordinator Layout : CoordinatorLayout is a super-powered FrameLayout.CoordinatorLayout is intended for two primary use cases:
- As a top-level application decor or chrome layout
-As a container for a specific interaction with one or more child views
- As a top-level application decor or chrome layout
Build UI with views
- Create new layout. In the main menu, select
File > New > XML > Layout XML File
. there are other options also. - Use Palette window. if you dont see palette window, check
top left of design view
, you will see palette tab. double click it to expand.
Observer(Activity) and Observable class Deprecated
The Java language supports the MVC architecture with two classes:
- Observer: Any object that wishes to be notified when the state of another object changes.
- Observable: Any object whose state may be of interest, and in whom another object may register an interest
import java.util.*;
public class Model extends Observable {
Click Listener
public class MainActivity extends AppCompatActivity implements Observer, View.OnClickListener {
Button1.setOnClickListener(this);
MVC
Material Design Components
Material Design is a design system built and supported by Google designers and developers. Material.io includes in-depth UX guidance and UI component implementations for Android, Flutter, and the Web.
The latest version, Material 3, enables personal, adaptive, and expressive experiences – from dynamic color and enhanced accessibility, to foundations for large screen layouts and design tokens.
Visit
App Bar, Action Bar & Tool Bar
App bar is rather a component name from the design while Toolbar and ActionBar classes are about the implementation. So the question is - what is the difference between Toolbar and ActionBar.
Toolbar can be used as a standalone solution and can also be set as an Activity action bar using setSupportActionBar()
.Read more...
|
|