DOI: 10.5281/zenodo.18295657
title: UI-Land: Automated Adaptation of Android Portrait UIs to Landscape Mode

description: UI-Land: Automatic Landscape UI Adaptation for Android Apps

Overview

UI-Land is a framework designed to automatically adapt Android portrait UIs to landscape UIs while preserving structural consistency, visual aesthetics, and usability. It is aimed at assisting developers to efficiently design landscape interfaces without manual layout adjustments.

UI-Land consists of two main modules:





UI Consistency Classification: Groups UI components based on functional and visual relevance to maintain layout consistency.




UI Adaptation: Adjusts component sizes and positions for optimal landscape presentation using a genetic algorithm and position prioritization.





Features





Automatic Layout Conversion: Converts portrait layouts to landscape layouts while keeping component relationships intact.




Structural Preservation: Maintains functional grouping and alignment across orientation changes.




Aesthetic Optimization: Optimizes component sizes and positions for better user experience.




Extensible Metrics: Supports evaluation metrics like CA (Classification Accuracy), ICS (Intra-Class Similarity), and US (UI Similarity).




Developer-Friendly: Generates ready-to-use landscape UI XML and optionally provides code templates.





Method Modules

1. UI Consistency Classification





Functional Relevance: Components with similar functions are grouped together.




Visual Relevance: Components aligned visually in portrait mode maintain consistent relative positions in landscape mode.




Output: Component classes and grouping structure used for subsequent adaptation.



2. UI Adaptation





Position Priority: Determines optimal order of rows/columns based on component importance.




Genetic Algorithm Optimization: Computes optimal size for each component class to minimize overlap, maintain aspect ratio, and prevent screen overflow.




Fitness Metrics:





Relative Area




Aspect Ratio




Feasibility (no overflow)






Output: Fully adapted landscape layout XML with component positions and sizes.





Installation

Requires Python 3.8+ and the following packages:







 



pip install numpy pandas openpyxl





Usage

Step 1: Prepare Portrait UI Data





Extract the component hierarchy (VH) and coordinates from the XML layout using Android UI Automator.




Save as JSON files: components.json and coordinates.json.



Step 2: Run UI-Land







 



python ui_land_main.py --input components.json --coords coordinates.json --output landscape_ui.xml







--input: Portrait UI component definitions




--coords: Coordinates of components in portrait mode




--output: Generated landscape UI XML



Step 3: Evaluate or Deploy





Use metrics CA, ICS, US to evaluate the layout (optional).




Import the generated XML into Android Studio for direct use.





Example Workflow





Parse the portrait UI XML using UI Automator.




Classify components via UI Consistency Classification.




Apply UI Adaptation module to compute optimal sizes and positions.




Generate landscape layout XML and preview in an emulator.




Optionally, submit as a pull request to integrate into the app.