Pages

About

Pages - Menu

Ads 468x60px

Social Icons

Main Menu

Featured Posts

Thursday, 19 June 2014

AnalogClock

Using AnalogClock

package app.Test;

import android.app.Activity;
import android.os.Bundle;

public class appTest extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}


 
//main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    
   <SlidingDrawer
     android:id="@+id/drawer"
     android:layout_width="320dip"
     android:layout_height="440dip"
     android:orientation="vertical"
     android:handle="@+id/handle"
     android:content="@+id/content">
     
      <ImageView
         android:id="@+id/handle"
         android:layout_width="48dip"
         android:layout_height="48dip"
     android:src="@drawable/icon"  />
     
    <AnalogClock android:id="@+id/content"
         android:background="#D0A0A0"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent" />
         
   </SlidingDrawer>
   
</RelativeLayout>
 



DigitalClock and AnalogClock

package app.test;

import android.app.Activity;
import android.os.Bundle;

public class Test extends Activity {
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
  }
}

//main.xml


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
  <AnalogClock android:id="@+id/analog"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentTop="true"
    />
  <DigitalClock android:id="@+id/digital"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/analog"
    />
</RelativeLayout>
  


Define AnalogClock and DigitalClock in xml 

package app.test;

import android.app.Activity;
import android.os.Bundle;

public class Test extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
    }
}

///main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    
<AnalogClock 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
    
<DigitalClock
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />    
           
</LinearLayout>

   

0 comments:

Post a Comment

Followers