All Projects → riteshakya037 → RatioLayouts

riteshakya037 / RatioLayouts

Licence: MIT license
A collection of ViewGroups which can have a constant width to height ratio.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to RatioLayouts

Easyflipview
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.
Stars: ✭ 1,221 (+6326.32%)
Mutual labels:  layouts, custom-view
Uistatus
一个简单且强大的Ui状态视图控制库!
Stars: ✭ 137 (+621.05%)
Mutual labels:  layouts
DataViewExtenders
Extenders for WinForms controls, such as DataGridView, DataGridViewColumn, FlowLayoutPanel, TableLayoutPanel, etc
Stars: ✭ 22 (+15.79%)
Mutual labels:  layouts
Bootstrap4layouts
A Template for Bootstrap 4 based on my Bootstrap 4 Layouts course on LinkedIn Learning
Stars: ✭ 44 (+131.58%)
Mutual labels:  layouts
Handlebars Layouts
Handlebars helpers which implement layout blocks similar to Jinja, Nunjucks (Swig), Pug (Jade), and Twig.
Stars: ✭ 336 (+1668.42%)
Mutual labels:  layouts
Discrollview2
[DEPRECATED]Android Library for fancy layouts
Stars: ✭ 79 (+315.79%)
Mutual labels:  layouts
react-layout-transition
Trying to make layout transitions simple
Stars: ✭ 57 (+200%)
Mutual labels:  layouts
layouts-ezplatform
Netgen Layouts & eZ Platform integration
Stars: ✭ 14 (-26.32%)
Mutual labels:  layouts
Contour
Layouts with lambdas 😎
Stars: ✭ 1,325 (+6873.68%)
Mutual labels:  layouts
Xamcustomlayouts
Xamarin.Forms Custom Layouts - Cards
Stars: ✭ 15 (-21.05%)
Mutual labels:  layouts
Nepali Romanized Pro
Nepali Romanized Keyboard Layout with installer for macOS
Stars: ✭ 18 (-5.26%)
Mutual labels:  layouts
Driveway
pure CSS masonry layouts
Stars: ✭ 607 (+3094.74%)
Mutual labels:  layouts
Ordnung
The 1kb alternative to Isotope
Stars: ✭ 79 (+315.79%)
Mutual labels:  layouts
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+16647.37%)
Mutual labels:  layouts
Bedrock
Foundational Layout Primitives for your React App
Stars: ✭ 173 (+810.53%)
Mutual labels:  layouts
Desenvolvimento-Android-do-absoluto-zero-para-iniciantes
Visite meu site e conheça todos os meus cursos 100% on-line.
Stars: ✭ 33 (+73.68%)
Mutual labels:  layouts
Vue Horizontal
An ultra simple pure vue horizontal layout for modern responsive web with zero dependencies. (SPA/SSG/SSR)
Stars: ✭ 75 (+294.74%)
Mutual labels:  layouts
PercentBarView
PercentBar
Stars: ✭ 26 (+36.84%)
Mutual labels:  custom-view
Bforartists
Bforartists is a fork of the popular 3D software Blender, with the goal to improve the UI.
Stars: ✭ 240 (+1163.16%)
Mutual labels:  layouts
Lain
Awesome WM complements
Stars: ✭ 716 (+3668.42%)
Mutual labels:  layouts

Download

Depricated

With introduction of ConstraintLayout you don't have to write either a single line of code or use third-parties.

Here's the example of how to keep 1:1 aspect ratio for your layout using ConstraintLayout:

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <View
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginEnd="0dp"
        android:layout_marginStart="0dp"
        android:layout_marginTop="0dp"
        android:background="@android:color/black"
        app:layout_constraintDimensionRatio="H,1:1"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

   </View>

</android.support.constraint.ConstraintLayout>

Ratio Layouts

A collection of ViewGroups which can have a constant width to height ratio.

Demo

Ratio Layouts (APK)

Assign a ratio and never worry about your views looking out of propotions.

Installation

Gradle

dependencies {
    compile "com.ritesh:ratiolayout:${latestVersion}"
}

Usage

Define 'app' namespace on root view in your layout

xmlns:app="http://schemas.android.com/apk/res-auto"

Include this library in your layout

<com.ritesh.ratiolayout.RatioRelativeLayout
        android:id="@+id/activity_main_ratio_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:fixed_attribute="WIDTH"
        app:horizontal_ratio="1"
        app:vertical_ratio="1">

Supported Attributs

XML Attribut Programmatical Getters Description
app:fixed_attribute getFixedAttribute() Set one side of the layout as fixed, calculating the other based on this
app:horizontal_ratio getHorizontalRatio() Horizontal aspect ratio.
app:vertical_ratio getVerticalRatio() Vertical aspect ratio.

Supported Layouts

  • RatioFrameLayout
  • RatioGridLayout
  • RatioLinearLayout
  • RatioRelativeLayout
  • RatioTableLayout

Supported Java Setters

  • setRatio(float horizontalRatio, float verticalRatio) - Sets ratios
  • setRatio(FixedAttribute fixedAttribute, float horizontalRatio, float verticalRatio) - Sets ratios along with Fixed Side.

Contact me

If you have a better idea or way on this project, please let me know, thanks :)

Email

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].