Android Tutorials - Herong's Tutorial Examples - v3.05, by Herong Yang
AndroidView v3.2 - Layouts with Horizontal Orientation
This section provides a tutorial example on how to develop a layout resource file to display all fields in blocks in horizontal orientation.
Here is my second try with .\res\layout\main.xml:
<?xml version="1.0" encoding="utf-8"?> <!-- AndroidView_layout.xml - Version 3.2 - Putting two blocks side-by-side - Copyright (c) 2012, HerongYang.com, All Rights Reserved. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <LinearLayout android:id="@+id/lContact" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" /> <LinearLayout android:id="@+id/lAddress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" /> </LinearLayout> <LinearLayout android:id="@+id/lAction" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" /> </LinearLayout>
With this layout resource file, I am expecting that the Contact block and Address block will be displayed side. The Action block will be displayed below them.
Without any changes in the Java code, I rebuild, install and run the application again on the emulator. I see this on the emulator:
The layout does not look so nice. But it matches what the resource is asking. Additional borders, spaces and colors can be added to make it better.
Table of Contents
Installing JDK 1.8 on Windows System
Installation of Android SDK R24 and Emulator
Installing Apache Ant 1.9 on Windows System
Developing First Android Application - HelloAndroid
Android Application Package (APK) Files
Android Debug Bridge (adb) Tool
AboutAndroid - Application to Retrieve System Information
android.app.Activity Class and Activity Lifecycle
►View Objects and Layout Resource Files
android.view.View Class - Base of User Interface Components
View, ViewGroup, Layout, and Widget
AndroidView v1.0 - Creating a Layout in Java Class
AndroidView v2.0 - Creating a Layout in Resource File
AndroidView v3.0 - Referencing Views in Resource Files
AndroidView v3.1 - Layouts with Vertical Orientation
►AndroidView v3.2 - Layouts with Horizontal Orientation
AndroidView v4.0 - Inserting Views to Parent Layout
Using "adb logcat" Command for Debugging
Build Process and Package File Content
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
USB Debugging Applications on LG-V905R Tablet