Android App Development : Nuances

Points Covered

Layout Types

Official Doc

  1. Linear Layout
    LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally.
     "Android Layout Types"

  2. Relative Layout
    RelativeLayout is a view group that displays child views in relative positions.

  3. Table Layout
    TableLayout is a view that groups views into rows and columns.

  4. Absolute Layout
    AbsoluteLayout enables you to specify the exact location of its children.

  5. Frame Layout
    The FrameLayout is a placeholder on screen that you can use to display a single view.

  6. List View
    ListView is a view group that displays a list of scrollable items.

  7. Grid View
    GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid.

  8. 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

  9. 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

Build UI with views

reference

  1. Create new layout. In the main menu, select File > New > XML > Layout XML File. there are other options also.
  2. 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

Example

import java.util.*;  
public class Model extends Observable {

Click Listener

public class MainActivity extends AppCompatActivity implements Observer, View.OnClickListener {
Button1.setOnClickListener(this);

MVC

https://www.geeksforgeeks.org/mvc-model-view-controller-architecture-pattern-in-android-with-example/

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

  1. Older Version, V2
  2. Current Version

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...