Scolly thing

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

Scolly thing

Postby TRDanny » Tue Jul 14, 2009 8:39 pm

Hi

I am making an application with lots of buttons, so I have like this:

<Button android:id="@+id/a1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A 1"/>
<Button android:id="@+id/a2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A 2"/>
<Button android:id="@+id/a3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A 3"/>
<Button android:id="@+id/a4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A 4"/>
<Button android:id="@+id/a5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A5"/>
<Button android:id="@+id/a6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A6"/>
<Button android:id="@+id/a7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A 7"/>
<Button android:id="@+id/a8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A8"/>
<Button android:id="@+id/a9"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A9"/>
<Button android:id="@+id/a10"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="A10"/>

But then I have too many buttons and Android doesn't like it. It only shows the first 9 buttons. How do I make a scrolly thing so I can scroll to the 10th button?

Thanks.
TRDanny
Freshman
Freshman
 
Posts: 7
Joined: Mon Jul 13, 2009 3:07 pm

Top

Postby nmc » Tue Jul 14, 2009 11:49 pm

Your buttons will be inside a LinearLayout-Container;
just parent that with a ScrollView Container:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <ScrollView>
  3.  
  4.    <LinearLayout>
  5.  
  6.       <Button>
  7.  
  8. ...
  9.  
  10.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
nmc
Senior Developer
Senior Developer
 
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests