android GUI vs XML (android/samples/app)

IT(Old)/Android 2007. 12. 4. 12:23

forwarding.xml

사용자 삽입 이미지
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
    android:gravity="center_horizontal"
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TextView
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:paddingBottom="4dip"
        android:text="@string/forwarding"/>

    <Button id="@+id/go"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="@string/go">
        <requestFocus />
    </Button>

</LinearLayout>
-----------------------------------------------------------------------------------------------------
2. hello_world.xml

사용자 삽입 이미지

<TextView xmlns:android="http://schemas.android.com/apk/res/android" id="@+id/text"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:gravity="center_vertical" android:textAlign="center"
    android:text="@string/hello_world"/>

-----------------------------------------------------------------------------------------------------
3. save_restore_state.xml

사용자 삽입 이미지
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TextView id="@+id/msg"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:paddingBottom="4dip" />

    <TextView
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:paddingBottom="4dip"
        android:text="@string/saves_state"/>

    <EditText id="@+id/saved"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/green"
        android:text="@string/initial_text">
        <requestFocus />
    </EditText>

    <TextView
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:paddingTop="8dip"
        android:paddingBottom="4dip"
        android:text="@string/no_saves_state"/>

    <EditText
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/red"
        android:text="@string/initial_text">
    </EditText>

</LinearLayout>

-----------------------------------------------------------------------------------------------------
4. receive_result.xml

사용자 삽입 이미지

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
    android:gravity="center_horizontal"
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TextView
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:paddingBottom="4dip"
        android:text="@string/receive_result_instructions"/>

    <TextView id="@+id/results"
        android:layout_width="fill_parent" android:layout_height="10dip"
        android:layout_weight="1"
        android:paddingBottom="4dip"
        android:background="@drawable/green">
    </TextView>

    <Button id="@+id/get"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:text="@string/receive_result_result">
        <requestFocus />
    </Button>

</LinearLayout>
-----------------------------------------------------------------------------------------------------
5. redirect_enter.xml

사용자 삽입 이미지

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
    android:gravity="center_horizontal"
    android:layout_width="fill_parent" android:layout_height="fill_parent">

    <TextView
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="0"
        android:paddingBottom="4dip"
        android:text="@string/redirect_enter"/>

    <Button id="@+id/go"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="@string/go">
        <requestFocus />
    </Button>

</LinearLayout>

-----------------------------------------------------------------------------------------------------
6. translucent_background.xml

사용자 삽입 이미지
<TextView xmlns:android="http://schemas.android.com/apk/res/android" id="@+id/text"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:gravity="center_vertical" android:textAlign="center"
    android:text="@string/translucent_background"/>

-----------------------------------------------------------------------------------------------------
7. TranslucentFancyActivity.java

사용자 삽입 이미지

protected void onCreate(Bundle icicle)
    {
        // Be sure to call the super class.
        super.onCreate(icicle);

        // Have the system blur any windows behind this one.
        getWindow().setFlags(WindowManager.LayoutParams.BLUR_BEHIND_FLAG,
                WindowManager.LayoutParams.BLUR_BEHIND_FLAG);
       
        // Apply a tint to any windows behind this one.  Doing a tint this
        // way is more efficient than using a translucent background.  Note
        // that the tint color really should come from a resource.
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.tintBehind = 0x60000820;
        getWindow().setAttributes(lp);
       
        // See assets/res/any/layout/translucent_background.xml for this
        // view layout definition, which is being set here as
        // the content of our screen.
        setContentView(R.layout.translucent_background);
    }