Views_Layout_BaseLine

old/API_Demo 2010. 4. 26. 10:55

[기본 Form]
 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="3dip"
        android:text="@string/baseline_2_label" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="3dip"
        android:text="@string/baseline_2_button" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:text="@string/baseline_2_bigger" />

</LinearLayout>



[baseline_1.xml] - Top


[baseline_2.xml] - Bottom

attr 추가 -> android:layout_gravity="bottom"


[baseline_3.xml] - Center

attr 추가 -> android:layout_gravity="center_vertical"


[baseline_4.xml] - Everywhere

Randomize


[baseline_6.xml] - Multi-Line

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <EditText android:id="@+id/anchor"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:textSize="20sp"
        android:text="@string/baseline_6_multi_line" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@id/anchor"
        android:layout_alignRight="@id/anchor"
        android:text="@string/baseline_6_baseline" />

</RelativeLayout>

-[strings.xml]

  <string name="baseline_6_multi_line">This is a\nmulti-line field.</string>
   <string name="baseline_6_baseline">Baseline Aligned</string>


[baseline_6.xml] - Relative

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView android:id="@+id/anchor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"

        android:textStyle="bold"
        android:text="@string/baseline_7_fat" />

    <TextView
        android:layout_width="wrap_content"
         android:layout_alignParentRight="true"
        android:layout_alignBaseline="@id/anchor"
        android:layout_height="wrap_content"
        android:text="@string/baseline_7_lean" />
   
</RelativeLayout>


[baseline_7.xml] - Nested Example1

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="3dip"
        android:layout_gravity="center_vertical"
        android:text="@string/baseline_nested_1_label" />

    <LinearLayout
            android:orientation="vertical"
            android:baselineAlignedChildIndex="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dip"
            android:text="@string/baseline_nested_1_label" />
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_down_float"/>
    </LinearLayout>

    <LinearLayout
            android:orientation="vertical"
            android:baselineAlignedChildIndex="2"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_height="wrap_content">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dip"
            android:text="@string/baseline_nested_1_label" />
    </LinearLayout>


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:layout_gravity="center_vertical"
        android:text="@string/baseline_nested_1_label" />


</LinearLayout>



[baseline_8.xml] - Nested Example2

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="3dip"
        android:layout_gravity="center_vertical"
        android:text="@string/baseline_nested_1_label" />

    <LinearLayout
            android:orientation="vertical"
            android:baselineAlignedChildIndex="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dip"
            android:text="@string/baseline_nested_1_label" />
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_down_float"/>
    </LinearLayout>

    <LinearLayout
            android:orientation="horizontal"
            android:baselineAlignedChildIndex="2"
            android:layout_width="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_height="wrap_content">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dip"
            android:text="@string/baseline_nested_1_label" />
    </LinearLayout>


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:layout_gravity="center_vertical"
        android:text="@string/baseline_nested_1_label" />


</LinearLayout>


[baseline_1.xml] - Nested Example3

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="3dip"
        android:layout_gravity="center_vertical"
        android:text="@string/baseline_nested_1_label" />

    <LinearLayout
            android:orientation="vertical"
            android:baselineAlignedChildIndex="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dip"
            android:text="@string/baseline_nested_1_label" />
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_down_float"/>
    </LinearLayout>

    <LinearLayout
                android:orientation="vertical"
             android:baselineAlignedChildIndex="1"

                android:layout_width="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_height="wrap_content">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/arrow_up_float"/>
        <LinearLayout
                android:orientation="vertical"
                android:baselineAlignedChildIndex="2"
                android:layout_width="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_height="wrap_content">
            <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/arrow_up_float"/>
            <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/arrow_up_float"/>
            <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="5dip"
                    android:text="@string/baseline_nested_1_label"/>
        </LinearLayout>
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:layout_gravity="center_vertical"
        android:text="@string/baseline_nested_1_label" />


</LinearLayout>

'old > API_Demo' 카테고리의 다른 글

Views_Layout_Linear Layout_Horizontal  (0) 2010.04.26
Views_Layout_Linear Layout_Vertical  (0) 2010.04.26
Views_Layout Animation_Nested Animation  (0) 2010.04.26
Views_Layout Animation_Wave Scale  (0) 2010.04.26
Views_Layout Animation_Grid Direction  (0) 2010.04.26
Posted by jazzlife
,