This is a mirror of official site: http://jasper-net.blogspot.com/

Working With Android ScrollView in VS2010

| Monday, July 25, 2011
Introduction

ScrollView is one of Android's most commonly used widgets and is also one of the easiest to use. When something is too big to fit on the screen, data may span the size of the screen so that some of it may not appear.

ScrollView gives us a scrollable layout for large data. We have two types of ScrollView; that is, ScrollView and HorizontalScrollView and we can say that they are a layout container for a view hierarchy that can be scrolled vertically or horizontally by the user, allowing it to be larger than the physical display.

In the example that follows let's imagine that you need to display a piece of text and a couple of buttons. The length of the text is longer than the screen and because of that all your buttons will not show on the screen. Let us see an example:

<?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"
    >
  <TextView
     android:layout_width="fill_parent"
     android:text="The basic unit of the Android UI is the View. A View represents
        a widget that has an appearance on the screen. An Activity contains Views and
         ViewGroups. Examples of widgets are buttons, labels, text boxes, etc. One or
        more Views can be grouped together into a ViewGroup. A ViewGroup provides the
        layout in which you can order the appearance and sequence of views. Examples
        of View groups are LinearLayout, Relative Layout, etc. "
     android:layout_height="wrap_content"
     android:id="@+id/txt"
    />
  <Button
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="First Step"  
    />
  <Button
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="Second Step"   
    />


Read more: C# Corner
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://www.c-sharpcorner.com/UploadFile/manish1231/8418/

Posted via email from Jasper-net

0 comments: