Skip to main content
# XmlArrangement - Android

* XML Arrangement Rules Generator for Android CodeStyle

---

## Before
```xml
<TextView
android:id="@+id/example"
style="@style/AppTheme.TextView.Example"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:gravity="center_vertical"
tools:text="Lorem Ipsum..."
android:paddingLeft="8dp" />

<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:hint="Hint for Name"
android:layout_height="wrap_content" />

<Button
android:visibility="gone"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentRight="true" />
```

## After
```xml
<TextView
android:id="@+id/example"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:paddingLeft="8dp"
style="@style/AppTheme.TextView.Example"
android:gravity="center_vertical"
tools:text="Lorem Ipsum..."/>

<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Hint for Name"/>

<Button
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentRight="true"
android:visibility="gone"/>
```

## How to use?

### 1) Create a file to describe your desired order: (empty lines are ignored)

```txt
xmlns:android
xmlns:.*

android:id
android:name

android:layout_width
android:layout_height
android:minWidth
android:minHeight

android:.*
.*
```

See [example.txt](example.txt)

### 2) Run:

```
user@machine:~$ xmlarrangement-android my-order.txt > rules.xml
```

### 3) Install:

* Android Studio **>** Preferences **>** CodeStyle **>** Scheme **>** Manage **>** Export

* Open exported file and rename your scheme, e.g. `<code_scheme name="NewScheme">`

* Find the line `<codeStyleSettings language="XML">`

* You should see a structure like this:
```xml
<arrangement>
<rules>
...
</rules>
</arrangement>
```

* Replace the content inside `<rules></rules>` with the content of `rules.xml`

* Copy new file to Android Studio codestyle path:
* **Mac**: ~/Library/Preferences/AndroidStudioX.X/config/codestyles/
* **Linux**: ~/.AndroidStudioX.X/config/codestyles/
* **Windows**: %USERPROFILE%\\.AndroidStudioX.X\config\codeStyles

* Restart AndroidStudio, go to Preferences **>** CodeStyle **>** Scheme and apply `NewScheme`.


## Installation

- Simple, using PyPI:

```
user@machine:~$ [sudo] pip install xmlarrangement-android
```

- or download the source and:

```
user@machine:~$ [sudo] python setup.py install
```


## References

* [Formatting xml layout files for Android](https://medium.com/@VeraKern/formatting-xml-layout-files-for-android-47aec62722fc#.bt8shn2qx)

Metadata

Release files for xmlarrangement-android 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xmlarrangement-android 0.1.1
File Size Uploaded Provenance Actions
xmlarrangement-android-0.1.1.tar.gz 15.6 kB Without provenance Details for xmlarrangement-android-0.1.1.tar.gz

Release files / xmlarrangement-android-0.1.1.tar.gz

Download URL xmlarrangement-android-0.1.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1313bcc4cf37ed923301f4690f600d33e49b1b8821f21924b409402f7efd9b15
BLAKE2b-256 checksum
How to use checksums
0ad80926d66a6dde85a79b69ae89d23f987c5e9618cfb589b6e4008be7e8427f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for xmlarrangement-android 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page