Wednesday 6 June 2012

Simple Scrollview Demo



/* This is Simple Scrollview Demo Android */


main.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
<ScrollView
    android:id="@+id/scroller"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">
    <LinearLayout
       android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">"
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 1"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 2"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 3"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 4"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 5"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 6"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 7"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 8"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 9"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
  <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 16"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 17"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 18"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 19"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    <TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:text="Text 20"
       android:layout_marginTop="10dp"
       android:layout_marginLeft="140dp">      
    </TextView>
    </LinearLayout>
</ScrollView>
</LinearLayout>


ScrollviewDemoActivity.java


package com.scrollviewdemo;

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

public class ScrollviewDemoActivity extends Activity {
    /** Called when the activity is first created. */

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}




0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Best Web Host