Easy Tutorial
❮ Java Json Instro Cpp Const Keyword ❯

2.2.6 AbsoluteLayout (Absolute Layout)

Category Android Basic Beginner Tutorial

Introduction to This Section

>

Previously, we have covered the five major layouts in Android. In this section, we will discuss the sixth layout, AbsoluteLayout (Absolute Layout). This layout is often placed last because it is rarely used in practice. You can skip this section if you prefer, but as a programmer who enjoys expanding knowledge, it's worth understanding AbsoluteLayout. If you have studied Java, you might be familiar with Absolute Layout from Java Swing (not Spring). The reason we use it sparingly in Android development is that our apps need to be adaptable across various devices. Using Absolute Layout could result in components displaying correctly on a 4-inch screen but misaligned or distorted on a 5-inch screen. Therefore, it's not recommended for use. However, if you are new to coding and want to experiment with Android, you can drag and drop components onto the interface using ADT. AbsoluteLayout positions components directly via X and Y coordinates in the Activity, with units in dp.


1. Four Major Control Attributes (Units are dp):

① Control Size: android:layoutwidth: Component width android:layoutheight: Component height ② Control Position: android:layoutx: Set component's X coordinate android:layouty: Set component's Y coordinate


2. Usage Example:

A simple login interface, created by dragging components in ADT, the code is omitted:

① Set to AbsoluteLayout: -3.8 Gestures

-4.1.1 Activity Beginner

-4.1.2 Activity Intermediate

-4.1.3 Activity Advanced

-4.2.1 Service Beginner

-4.2.2 Service Intermediate

-4.2.3 Service Advanced

-4.3.1 BroadcastReceiver Beginner

-4.3.2 BroadcastReceiver Intermediate

-4.4.1 ContentProvider Beginner

-4.4.2 ContentProvider Intermediate - Document Provider

-4.5.1 Basic Usage of Intent

-4.5.2 Passing Complex Data with Intent

-5.1 Basic Overview of Fragment

-5.2.1 Fragment Example Detailed - Bottom Navigation Bar Implementation (Method 1)

-5.2.2 Fragment Example Detailed - Bottom Navigation Bar Implementation (Method 2)

-5.2.3 Fragment Example Detailed - Bottom Navigation Bar Implementation (Method 3)

-5.2.4 Fragment Example Detailed - Bottom Navigation Bar + ViewPager Swipe to Switch Pages

-5.2.5 Fragment Example Detailed - Simple Implementation of News (Shopping) App List Fragment

-6.1 Data Storage and Access - File Storage and Reading/Writing

-6.2 Data Storage and Access - SharedPreferences for Saving User Preferences

-6.3.1 Data Storage and Access - Introduction to SQLite Database

-6.3.2 Data Storage and Access - Further Exploration of SQLite Database

-7.1.1 Android Network Programming Essentials and Learning HTTP Protocol

-7.1.2 Learning Android HTTP Request Headers and Response Headers

-7.1.3 Android HTTP Request Methods: HttpURLConnection

-7.1.4 Android HTTP Request Methods: HttpClient

-7.2.1 Android XML Data Parsing

-7.2.2 Android JSON Data Parsing

-7.3.1 Android File Upload

-7.3.2 Android File Download (1)

-7.3.3 Android File Download (2)

-7.4 Android Calling WebService

-7.5.1 Basic Usage of WebView (Web View)

-7.5.2 Basic Interaction Between WebView and JavaScript

-7.5.3 Considerations for WebView After Android 4.4

-7.5.4 WebView File Download

-7.5.5 WebView Cache Issues

-7.5.6 WebView Handling Error Code Information from Web Pages

-7.6.1 Socket Learning Network Basics Preparation

-7.6.2 Socket Communication Based on TCP Protocol (1)

-7.6.3 Socket Communication Based on TCP Protocol (2)

-7.6.4 Socket Communication Based on UDP Protocol

-8.1.1 Summary of 13 Drawable Types in Android Part 1

-8.1.2 Summary of 13 Drawable Types in Android Part 2

-8.1.3 Summary of 13 Drawable Types in Android Part 3

-8.2.1 Comprehensive Analysis of Bitmap (Bitmap) Part 1

-8.2.2 OOM Issues Caused by Bitmap

-8.3.1 Detailed Explanation of Three Drawing Tool Classes

-8.3.2 Practical Examples of Drawing Classes

-8.3.3 Paint API - MaskFilter (Mask)

-8.3.4 Paint API - Xfermode and PorterDuff Detailed Explanation (Part 1)

-8.3.5 Paint API - Xfermode and PorterDuff Detailed Explanation (Part 2)

-8.3.6 Paint API - Xfermode and PorterDuff Detailed Explanation (Part 3)

-8.3.7 Paint API - Xfermode and PorterDuff Detailed Explanation (Part 4)

-8.3.8 Paint API - Xfermode and PorterDuff Detailed Explanation (Part 5)

-8.3.9 Paint API - ColorFilter (Color Filter) (1/3)

-8.3.10 Paint API - ColorFilter (Color Filter) (2/3)

-8.3.11 Paint API - ColorFilter (Color Filter) (3/3)

-8.3.12 Paint API - PathEffect (Path Effect)

-8.3.13 Paint API - Shader (Image Rendering)

-8.3.14 Paint Enum/Constant Values and ShadowLayer Shadow Effect

-8.3.15 Paint API - Typeface (Font Style)

-8.3.16 Detailed Explanation of Canvas API (Part 1)

-8.3.17 Detailed Explanation of Canvas API (Part 2) Clipping Methods Collection

-8.3.18 Detailed Explanation of Canvas API (Part 3) Matrix and drawBitmapMesh

-8.4.1 Frame Animation in Android Animation Collection

-8.4.2 Tween Animation in Android Animation Collection

-8.4.3 Property Animation in Android Animation Collection - Introduction

-8.4.4 Property Animation in Android Animation Collection - Further Exploration

-9.1 Using SoundPool to Play Sound Effects (Duang~)

-9.2 MediaPlayer for Playing Audio and Video

-9.3 Using Camera to Take Photos

-9.4 Using MediaRecord to Record Audio -10.1 TelephonyManager (Phone Manager)

-10.2 SmsManager (SMS Manager)

-10.3 AudioManager (Audio Manager)

-10.4 Vibrator (Vibrator)

-10.5 AlarmManager (Alarm Service)

-10.6 PowerManager (Power Service)

-10.7 WindowManager (Window Management Service)

-10.8 LayoutInflater (Layout Service)

-10.9 WallpaperManager (Wallpaper Manager)

-10.10 Sensor Topic (1) – Introduction

-10.11 Sensor Topic (2) – Orientation Sensor

-10.12 Sensor Topic (3) – Accelerometer/Gyroscope Sensor

-10.12 Sensor Topic (4) – Understanding Other Sensors

-10.14 Android GPS Primer

-11.0《2015 Latest Android Basic Beginner's Tutorial》Completion Celebration~

-12.1 Android Practice: DrySister Viewing Girls App (Version 1) – Project Setup and Simple Implementation

-12.2 DrySister Viewing Girls App (Version 1) – 2. Parsing Backend Data

-12.3 DrySister Viewing Girls App (Version 1) – 3. Image Loading Optimization (Writing an Image Caching Framework)

-12.4 DrySister Viewing Girls App (Version 1) – 4. Adding Data Caching (Introducing SQLite)

-12.5 DrySister Viewing Girls App (Version 1) – 5. Code Review, Adjustment, and Logging Class Writing

-12.6 DrySister Viewing Girls App (Version 1) – 6. Icon Creation, Obfuscation, Signing, Packaging, APK Slimming, App Release

WeChat Subscription

❮ Java Json Instro Cpp Const Keyword ❯