How to make my form scrollable

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

How to make my form scrollable

Postby rakesh86shankar » Fri Feb 05, 2010 7:10 am

I have class that draws that pie chart,and i want to make it scrollable and how can i achieve it.

Regards
Rakesh Shankar.P
rakesh86shankar
Developer
Developer
 
Posts: 38
Joined: Fri May 29, 2009 9:51 am

Top

Postby BUKsAPPs » Fri Feb 05, 2010 5:45 pm

You didn't give us a whold lot of info about your problem. Do you load a resource file for your layout or do you generate the entire dialog through code? What are you drawing the chart onto?

Either way, I think what you probably want to look into is adding scrollbars to the view container that is holding your chart view. Here is a simple example of a vertical scrollbar in a linear layout.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2.     <LinearLayout android:id="@+id/layout_Main"
  3.  
  4.        android:layout_width="fill_parent"
  5.  
  6.        android:layout_height="wrap_content"
  7.  
  8.        android:orientation="vertical"
  9.  
  10.        android:padding="10dp"
  11.  
  12.        android:scrollbars="vertical"
  13.  
  14.        xmlns:android="http://schemas.android.com/apk/res/android">
  15.  
  16.    
  17.  
  18.         <ImageView android:id="@+id/imageA"
  19.  
  20.            android:layout_width="fill_parent"
  21.  
  22.            android:layout_height="wrap_content"
  23.  
  24.            android:src="@drawable/picA"
  25.  
  26.        />
  27.  
  28.         <TextView
  29.  
  30.            android:text="@string/strA"
  31.  
  32.            android:layout_width="fill_parent"
  33.  
  34.            android:layout_height="wrap_content"
  35.  
  36.            android:layout_marginTop="15dp"
  37.  
  38.            android:textSize="24sp"
  39.  
  40.        />
  41.  
  42.         <TextView
  43.  
  44.            android:layout_width="fill_parent"
  45.  
  46.            android:layout_height="wrap_content"
  47.  
  48.            android:text="@string/strB"
  49.  
  50.        />
  51.  
  52.     </LinearLayout>
  53.  
  54.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4

The LinearLayout uses a height of "wrap_content" and scrollbars "vertical" This keeps the LinearLayout from extending beyond its containing view, and puts a vertical scrollbar on the LinearLayout to be able to see any subViews that extend beyond its normal limits.
BUKsAPPs
Claustrum Lite - Area capture game
R:P:S Academy - play Rock/Paper/Scissors online
BUKsAPPs
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Sat Jan 16, 2010 9:01 pm
Location: USA

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests