alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Android example source code file (skeleton_activity.xml)

This example Android source code file (skeleton_activity.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Android by Example" TM.

Java - Android tags/keywords

again, apache, button, copyright, edittext, license, linearlayout, note, of, on, project, see, the, we

The skeleton_activity.xml Android example source code

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
          http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- This file describes the layout of the main SkeletonApp activity
     user interface.
 -->

<!-- The top view is a layout manager that places its child views into
     a row, here set to be vertical (so the first is at the top) -->

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

    <!-- First view is a text editor.  We want it to use all available
         horizontal space, and stretch to fill whatever vertical space
         is available to it.  Note the use of the "id" attribute, which
         allows us to find this object from the Java code. -->
    <EditText android:id="@+id/editor"
        android:layout_width="fill_parent" android:layout_height="0dip"
        android:autoText="true"
        android:capitalize="sentences"
        android:layout_weight="1"
        android:freezesText="true" >
        <requestFocus />
    </EditText>

    <!-- Next view is another linear layout manager, now horizontal.  We
         give it a custom background; see colors.xml for the definition
         of drawable/semi_black-->
    <LinearLayout
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" android:gravity="center_horizontal"
        android:orientation="horizontal"
        android:background="@drawable/semi_black">

        <!-- On the left: the "back" button.  See styles.xml for the
             definition of style/ActionButton, which we use to hold
             common attributes that are used for both this and the
             clear button.  See strings.xml for the definition of
             string/back. -->
        <Button android:id="@+id/back" style="@style/ActionButton"
            android:text="@string/back" />

        <!-- In the middle: a custom image, -->
        <ImageView android:id="@+id/image"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:paddingLeft="4dip" android_paddingRight="4dip"
            android:src="@drawable/violet" />

        <!-- On the right: another button, this time with its text color
             changed to red.  Again, see colors.xml for the definition. -->
        <Button android:id="@+id/clear" style="@style/ActionButton"
            android:text="@string/clear" android:textColor="@color/red" />

    </LinearLayout>

</LinearLayout>


Other Android examples (source code examples)

Here is a short list of links related to this Android skeleton_activity.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.