2010-03-27 6 views
0

Hé les gars, je suis assez nouveau sur la plate-forme android et j'ai une question très simple. Im mettre des boutons comme des dispositions avec des zones de texte, mais im manquer de place. Comment devrais-je permettre à l'utilisateur de faire défiler vers le bas pour voir plus de boutons et d'autres choses. Par exemple, si j'ai 6 boutons, et 3 sont dans le champ de vision, je veux être capable de faire défiler avec mon doigt et être capable de voir ces boutons que je défile.Basic Scolling Question

Merci pour l'aide les gars

-Localgamer

Répondre

1

Essayez ceci:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/proffrag" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="center" 
    android:background="#ffffff" 
    android:orientation="vertical" > 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="fill_parent" > 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" > 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       android:paddingLeft="30dip" 
       android:paddingRight="30dip" 
       android:paddingTop="10dip" > 

       <EditText 
        android:id="@+id/firstname" 
        style="@style/custom" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/rounded_edittext" 

        android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " 
        android:drawableLeft="@drawable/usernamem" 
        android:drawablePadding="10dp" 
        android:ems="10" 
        android:hint="@string/firstname" 
        android:inputType="textCapWords" 
        android:singleLine="true" > 

        <requestFocus /> 
       </EditText> 

       <View 
        android:layout_width="fill_parent" 
        android:layout_height="10dp" /> 

       <EditText 
        android:id="@+id/lastname" 
        style="@style/custom" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/rounded_edittext" 
        android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " 
        android:drawableLeft="@drawable/usernamem" 
        android:drawablePadding="10dp" 
        android:ems="10" 
        android:hint="@string/lastname" 
        android:inputType="textCapWords" 
        android:singleLine="true" /> 

       <View 
        android:layout_width="fill_parent" 
        android:layout_height="10dp" /> 

       <EditText 
        android:id="@+id/username" 
        style="@style/custom" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/rounded_edittext" 
        android:digits="[email protected]-." 
        android:drawableLeft="@drawable/usernamem" 
        android:drawablePadding="10dp" 
        android:ems="10" 
        android:hint="@string/username" 
        android:singleLine="true" /> 

       <View 
        android:layout_width="fill_parent" 
        android:layout_height="10dp" /> 

       <EditText 
        android:id="@+id/email" 
        style="@style/custom" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/rounded_edittext" 
        android:digits="[email protected]-.," 
        android:drawableLeft="@drawable/emailm" 
        android:drawablePadding="10dp" 
        android:ems="10" 
        android:hint="@string/email" 
        android:inputType="textEmailAddress" 
        android:singleLine="true" /> 

       <View 
        android:layout_width="fill_parent" 
        android:layout_height="10dp" /> 

       <TextView 
        android:id="@+id/selecttopic" 
        style="@style/custom" 
        android:layout_width="match_parent" 
        android:layout_height="20dp" 
        android:ems="10" 
        android:singleLine="true" 
        android:text="@string/selecttopic" /> 

       <RadioGroup 
        android:id="@+id/radioGroup1" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="10dp" 
        android:gravity="center" 
        android:orientation="horizontal" > 

        <RadioButton 
         android:id="@+id/radiosubject" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@drawable/rbtn_selector" 
         android:button="@null" 
         android:gravity="center" 
         android:padding="5dp" 
         android:text="Subject" 
         android:textColor="@drawable/rbtn_textcolor_selector" /> 

        <RadioButton 
         android:id="@+id/radiocourse" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@drawable/rbtn_selector" 
         android:button="@null" 
         android:gravity="center" 
         android:padding="5dp" 
         android:text="Courses" 
         android:textColor="@drawable/rbtn_textcolor_selector" /> 
       </RadioGroup> 

       <View 
        android:layout_width="fill_parent" 
        android:layout_height="10dp" /> 

       <TextView 
        android:id="@+id/selectgen" 
        style="@style/custom" 
        android:layout_width="match_parent" 
        android:layout_height="20dp" 
        android:ems="10" 
        android:singleLine="true" 
        android:text="@string/selectgen" /> 

       <RadioGroup 
        android:id="@+id/radioGroup2" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="10dp" 
        android:gravity="center" 
        android:orientation="horizontal" > 

        <RadioButton 
         android:id="@+id/radiomale" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@drawable/rbtn_selector" 
         android:button="@null" 
         android:gravity="center" 
         android:padding="5dp" 
         android:text="@string/selectmale" 
         android:textColor="@drawable/rbtn_textcolor_selector" /> 

        <RadioButton 
         android:id="@+id/radiofemale" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@drawable/rbtn_selector" 
         android:button="@null" 
         android:gravity="center" 
         android:padding="5dp" 
         android:text="@string/selectfemale" 
         android:textColor="@drawable/rbtn_textcolor_selector" /> 
       </RadioGroup> 

       <View 
        android:layout_width="fill_parent" 
        android:layout_height="10dp" /> 

       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" > 

        <TextView 
         android:id="@+id/proftextgender" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_alignParentLeft="true" 
         android:layout_centerVertical="true" /> 

        <Button 
         android:id="@+id/browse" 
         style="?android:attr/buttonStyleSmall" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_alignParentTop="true" 
         android:layout_centerHorizontal="true" 
         android:background="@drawable/mycustom_button" 
         android:minHeight="40dp" 
         android:text="@string/browse" 
         android:textColor="#ffffff" /> 
       </RelativeLayout> 
      </LinearLayout> 

      <View 
       android:layout_width="fill_parent" 
       android:layout_height="10dp" /> 

      <RelativeLayout 
       android:layout_width="fill_parent" 
       android:layout_height="50dp" 
       android:orientation="horizontal" 
       android:paddingLeft="10dp" 
       android:paddingRight="10dp" > 

       <LinearLayout 
        android:id="@+id/firs" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_alignParentLeft="true" 
        android:orientation="horizontal" 
        android:paddingLeft="20dp" > 

        <TextView 
         android:id="@+id/browseimage" 
         android:layout_width="109dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1.17" 
         android:maxLines="2" /> 
       </LinearLayout> 

       <View 
        android:id="@+id/vi" 
        android:layout_width="20dp" 
        android:layout_height="fill_parent" 
        android:layout_toRightOf="@id/firs" > 
       </View> 

       <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_toRightOf="@id/vi" 
        android:layout_weight="1" 
        android:orientation="horizontal" > 

        <Button 
         android:id="@+id/upload" 
         style="?android:attr/buttonStyleSmall" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@drawable/mycustom_button" 
         android:minHeight="30dp" 
         android:paddingLeft="20dp" 
         android:paddingRight="20dp" 
         android:text="@string/upload" 
         android:textColor="#ffffff" /> 
       </LinearLayout> 
      </RelativeLayout> 

      <View 
       android:layout_width="fill_parent" 
       android:layout_height="5dp" /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:gravity="center_horizontal" 
       android:orientation="horizontal" > 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:gravity="center_horizontal" 
       android:orientation="horizontal" 
       android:paddingLeft="30dp" 
       android:paddingRight="30dp" > 

       <Button 
        android:id="@+id/savechagnes" 
        style="?android:attr/buttonStyleSmall" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="@drawable/mycustom_button" 
        android:minHeight="40dp" 
        android:text="@string/savechanges" 
        android:textColor="#ffffff" /> 
      </LinearLayout> 

      <View 
       android:layout_width="fill_parent" 
       android:layout_height="5dp" /> 
     </LinearLayout> 
    </ScrollView> 

</LinearLayout>