RelativeLayout

Relative To Container These properties will layout elements relative to the parent container.

android:layout_alignParentBottom – Places the bottom of the element on the bottom of the container android:layout_alignParentLeft – Places the left of the element on the left side of the container android:layout_alignParentRight – Places the right of the element on the right side [...]

LinearLayout

LinearLayout เป็นการเรียง elements แบบเส้นตรง โดยมีทั้งแนวตั่งและแนวนอน โดยการระบุ android:orientation เข้าไป

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal"
	android:layout_width="fill_parent"
    android:layout_height="fill_parent">
     <button android:id="@+id/backbutton"
    	android:text="Back"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content" />
    <textview android:text="First Name"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content" />
    <edittext android:width="100px"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content" />
    <textview android:text="Last Name"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content" />
    <edittext android:width="100px"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content" /> 
</linearlayout>

Continue reading “LinearLayout” »

FrameLayout

FrameLayout เป็นการดีไซน์ให้แสดงเพียงแต่หนึ่งอย่างภายใน Layout หากเรามี หลาย element อยู่ใน FrameLayout ทุก element จะแสดงซ้อนทับกัน (คล้าย Layer ใน PhotoShop) ที่ตำแหน่งเริ่มต้นจะอยู่ที่มุมบนซ้าย

<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView android:src="@drawable/icon" android:scaleType="fitCenter" android:layout_height="fill_parent" android:layout_width="fill_parent"/> <TextView android:text="Learn-Android.com" android:textSize="24sp" android:textColor="#000000" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center"/> </FrameLayout>

Android Audio Recording Tutorial

package com.benmccann.android.hello; import java.io.File; import java.io.IOException; import android.media.MediaRecorder; import android.os.Environment; /** * @author <a href=”http://www.benmccann.com”>Ben McCann</a> */ public class AudioRecorder { final MediaRecorder recorder = new MediaRecorder(); final String path; /** * Creates a new audio recording at the given path (relative to root of SD card). */ public AudioRecorder(String path) { this.path = [...]

Kemtid for Android

Kemtid is community system to share travel experiences in Thailand. The system support users to watch interest trip, search another place in the system including display map and routing from user’s position to the searched place. Anyway users are interesting to share trip. Users can share by creating trip and upload picture including [...]