An open API service indexing awesome lists of open source software.

https://github.com/hossain-khan/android-constraint-layout-cheatsheet

A demo application for Android ConstraintLayout with various usage with sample code.
https://github.com/hossain-khan/android-constraint-layout-cheatsheet

android android-demo cheat-sheets cheatsheet constraint-layout constraintlayout

Last synced: 2 months ago
JSON representation

A demo application for Android ConstraintLayout with various usage with sample code.

Awesome Lists containing this project

README

        

[![CircleCI](https://circleci.com/gh/amardeshbd/android-constraint-layout-cheatsheet.svg?style=svg)](https://circleci.com/gh/amardeshbd/android-constraint-layout-cheatsheet) [![codebeat badge](https://codebeat.co/badges/bf0c09f2-f87c-49cc-b437-ee1a975ed830)](https://codebeat.co/projects/github-com-amardeshbd-android-constraint-layout-cheatsheet-master) [![Beta Badge](https://img.shields.io/badge/Google%20Play-BETA-orange.svg)](https://play.google.com/store/apps/details?id=com.hossainkhan.android.constraintlayout) [![](https://img.shields.io/github/release/amardeshbd/android-constraint-layout-cheatsheet.svg?label=latest)](https://github.com/amardeshbd/android-constraint-layout-cheatsheet/releases) ![](https://img.shields.io/badge/AS%20Compatibility-v4.0-green.svg?logo=android)

# ConstraintLayout Demo
> NOTE: See [official demo](#bookmark-official-demo) project by Google for complete set of examples.

A demo application for Android `ConstraintLayout` with various usage with sample code.

Get the **beta** release with current snapshot!
[![google-play-badge](https://user-images.githubusercontent.com/99822/40590807-b714614a-61d3-11e8-9fab-a6781bc670c2.png)](https://play.google.com/store/apps/details?id=com.hossainkhan.android.constraintlayout)

## :bookmark: Official Demo
Google has official demo project that contains a list of layouts that showcases the various features and usage of
[ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html) and
[MotionLayout](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout)

See https://github.com/android/views-widgets-samples/tree/master/ConstraintLayoutExamples

## Proposed App Features
* Have a grid containing different feature set of `ConstraintLayout`
* For each feature, have different examples
* Each example should allow you to share the code snippet or copy to clipboard
* Each example may also contain additional resource links to blog or technical articles
* Example may have set of sliders/toggle to change metrics dynamically to visualize.

See **[contribution](CONTRIBUTING.md)** guideline if you want to add demos or fix something.

### `ConstraintLayout` features to cover
> _TIP: Jump to [layout resources](https://github.com/amardeshbd/android-constraint-layout-cheatsheet/tree/master/app/src/main/res/layout) directoy to see existing layouts._

- [ ] Relative positioning
* [ ] Horizontal Axis: left, right, start and end sides
* [ ] Vertical Axis: top, bottom sides and text baseline
- [ ] Margins
- [x] Centering positioning and bias
- [x] Circular positioning _(Added in 1.1)_
- [x] Visibility behavior
- [ ] Dimension constraints
* [x] Ratio
* [x] Percent dimension
* [x] Min and Max
* [ ] `MATCH_CONSTRAINT` dimensions _(Added in 1.1)_
* [ ] `WRAP_CONTENT` : enforcing constraints _(Added in 1.1)_
* [ ] Widgets dimension constraints
- [ ] Chains
* [x] Chain Style
* [x] Weighted chains
* [ ] Margins and chains _(Added in 1.1)_
- [x] Virtual Helpers objects 🥇
* [x] Guideline
* [x] Barrier
* [x] Group
- [ ] Optimizer _(Added in 1.1)_
- [x] Fully functional demo screens 🥇
* [x] Movie Details Screen
* [x] TED Talk Preview Screen
* [x] Secure PIN Entry Screen

## Objective
These are the **my** objectives for this demo application.
* To explore all the features of constraint layout
* Learn and use material design component in the sample app
* Learn and use the new architecture components in the sample app
* Learn and use proper architecture for the app - likely MVVM
* Document everything well so that future external contribution is easier

## Preview
Here is a snapshot of current progress _(This will be updated from time to time)_.

![Browse Layout Variances - Landscape Mode](https://user-images.githubusercontent.com/99822/39678468-6de62ce8-515b-11e8-9516-5203bef17d8a.png)
![Show Layout Screen](https://user-images.githubusercontent.com/99822/39677193-c55efc3c-5144-11e8-822f-b55664d8e5e2.png) ![Complete Demo - Moview Details](https://user-images.githubusercontent.com/99822/56074662-80d4b280-5d84-11e9-83a5-4c6440662359.png) ![Complete Demo - TED Talk](https://user-images.githubusercontent.com/99822/58756502-b6199900-84c7-11e9-9b57-34455a1633cf.png) ![External Learning Resources](https://user-images.githubusercontent.com/99822/59073743-6dcaf400-8896-11e9-9a97-84d3ee384dee.png)

### Screencast
![screencast](https://user-images.githubusercontent.com/99822/55640296-50e04a80-5799-11e9-9209-01b99e7ddd52.gif)