Slides for a presentation given at forLoop 2, an event where software developers come around to interact and share knowledge on different technologies.
The most important elements to pay attention to <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" ... /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/blah" android:scaleType="centerCrop" ... />
4. Space! The most important elements to pay attention to A simple way to add spaces in your existing layouts <android.support.v4.widget.Space android:layout_width="match_parent" android:layout_height="8dp" /> <!-- From the v4 support library -->
4. Space! The most important elements to pay attention to Also set via view padding and layout_margins. <TextView ... android:paddingLeft="16dp" android:paddingRight="16dp" android:layout_margin="@dimen/text_margin"... />
4. Space 5. Layout 6. Color! The most important elements to pay attention to Color can be a powerful way of expressing brand and highlighting illustration in UI Check out material.google.com/style/color for more information
subclass Especially apparent in adapterviews that can have thousands of items For example, a view inside a grid view inside a list view inside a relative layout could get laid out 8 times(!)
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ui.AlbumDetailsActivity"> <include layout="@layout/appbar" /> <FrameLayout android:id="@+id/frame" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:src="@drawable/ic_add" app:backgroundTint="@color/colorFAB" app:rippleColor="@color/colorRippleLight" app:layout_anchor="@id/frame" app:layout_anchorGravity="bottom|right" android:layout_margin="@dimen/spacing_16" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.design.widget.CoordinatorLayout> Appbar is a great example of a widget you can reuse across your entire app.
be a dream or a worst nightmare. Load images on a background thread or even better use an image loader Glide (personal fave) or Picasso • Eliminate unnecessary backgrounds