Android Layouts – An Introduction to Android Visual Development – Types of Views



Android Layouts – An Introduction to Android Visual Development – Types of Views

0 0


android-layouts-slides


On Github vinc3m1 / android-layouts-slides

Android Layouts

An Introduction to Android Visual Development

Created by Vince Mi / @v_mi

Everything here is even better in the official documentation:

Buildling a Simple User Interface

Layouts Developer Guide

XML

Android Layouts are defined in XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent" 
              android:layout_height="fill_parent" 
              android:orientation="vertical" >
    <TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Hello, I am a TextView" />
    <Button android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello, I am a Button" />
</LinearLayout>

There are graphical tools available...

But we're developers!

Types of Views

Views ViewGroups AdapterViews

Views

  • TextView
    • EditText
    • Button
      • Switch
      • RadioButton
      • CheckBox
  • ImageView
    • ImageButton
  • SurfaceView

...

ViewGroup

ViewGroups

  • FrameLayout
  • LinearLayout
  • RelativeLayout

...

AdapterView

AdapterView

  • AbsListView
    • ListView
    • GridView
  • AbsSpinner
    • Spinner

Defining a Layout

Basic Layout definition:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" />

Linear Layout

Relative Layout

DEMO! ...

aka me improvising

THE END

BY Vince Mi / @v_mi