rongi/rotate-layout


Android layout that can rotate any view.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.rongi:rotate-layout:v3.0.0'
	}
	dependencies {
		implementation("com.github.rongi:rotate-layout:v3.0.0")
	}
	<dependency>
	    <groupId>com.github.rongi</groupId>
	    <artifactId>rotate-layout</artifactId>
	    <version>v3.0.0</version>
	</dependency>

                            
    libraryDependencies += "com.github.rongi" % "rotate-layout" % "v3.0.0"
        
        

                            
    :dependencies [[com.github.rongi/rotate-layout "v3.0.0"]]
        
        

Readme


Rotate Layout

A custom layout that can rotate it's view

Example

Usage

In your layout file add

<com.github.rongi.rotate_layout.layout.RotateLayout
	xmlns:app="http://schemas.android.com/apk/res-auto"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	app:angle="90">	<!-- Specify rotate angle here -->

	<YourLayoutHere
		android:layout_width="wrap_content"
		android:layout_height="wrap_content">
	</YourLayoutHere>
</com.github.rongi.rotate_layout.layout.RotateLayout>

Voila! Your layout will be rotated 90 degrees.

Download

implementation 'rongi.rotate-layout:rotate-layout:3.0.0'

Features

  1. The rotated view receives correct touch events.
  2. The bounding box is also rotated. This means that if the view was 100x50px before the rotation, then after 90 degrees rotation it will be 50x100px and can fit into another layout with this dimensions.