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

https://github.com/nitiwari-dev/android-percent-layout-sample

Note: Its build using ConstraintLayout. The sample is an alternative for nested layouts. Build to remove nested structure and create a flat xml layout, which eventually improves performance
https://github.com/nitiwari-dev/android-percent-layout-sample

android android-application android-percent-layout android-ui constraint-layout constraint-programming constraintheight demo example-code layout-height-percent layout-width-percent library percent percentframelayout relativelayout support xml

Last synced: 5 months ago
JSON representation

Note: Its build using ConstraintLayout. The sample is an alternative for nested layouts. Build to remove nested structure and create a flat xml layout, which eventually improves performance

Awesome Lists containing this project

README

          

[![platform](https://img.shields.io/badge/platform-Android-yellow.svg)](https://www.android.com)
[![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=plastic)](https://android-arsenal.com/api?level=14)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html)

# Update
Below example in created using `ConstraintLayout` since percent support library is deprecated from API level 26.0.0.

# Integration and Example
This sample uses `ConstraintLayout` to build xml UI. Helps to avoid the overhead of Nested layouts and thereby improving performance.

Really awesome!!!

![size_1_1](https://user-images.githubusercontent.com/10304040/37208672-3542600c-23c8-11e8-92a1-32784c9e0348.png)
![size_1_2](https://user-images.githubusercontent.com/10304040/37208806-b48731c6-23c8-11e8-9f61-d41084ef6a28.png)
![size_1_3](https://user-images.githubusercontent.com/10304040/37208813-ba672eca-23c8-11e8-96fc-655980f68d8d.png)
![background](https://user-images.githubusercontent.com/10304040/45996611-67a33780-c0ba-11e8-8205-eba7d06a794c.png)

Steps:

1. Add below into build.gradle

` compile 'com.android.support.constraint:constraint-layout:1.1.0-beta3'`

2. Add `layout_constraintHeight_percent` and `layout_constraintWidth_percent` to specify the percentage range.

3. Finally add `layout_constraintWidth_default="percent"` and `layout_constraintHeight_default="percent"`. Thats it !!!.

```xml


```

Bingo we are done !!!

## Licence
Copyright (C) 2020 Nitesh Tiwari.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.