2011-03-18 6 views
0

est-il un moyen de définir la couleur d'arrière-plan pour l'élément scrollview? J'ai essayé le code suivant ci-dessous, mais les couleurs ne sont pas appliquées:Android défilement couleur de fond

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/ScrollView01" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:scrollbars="vertical" android:background="@color/colorWhite"> 
<?xml version="1.0" encoding="utf-8"?> 

<resources> 
    <string name="app_name">Trackfolio</string> 
    <color name="colorWhite">#FFFFFF</color> 
    <color name="colorBlack">#000000</color> 
    <color name="colorLightBlue">#33A1C9</color> 
</resources> 
+0

Est-ce tout dans un seul fichier? La mise en page et les types de ressources doivent se trouver dans des fichiers différents. Donc vous auriez res/layout/scrollview.xml, res/values ​​/ resources.xml. Mais s'ils sont dans des fichiers séparés, votre syntaxe semble correcte. Le contenu de ScrollView est-il correctement affiché? –

+1

Oui, ils sont dans des fichiers différents. ce sont les coupures de code – locoboy

+0

quel type d'élément insérez-vous dans votre Scrollview? – Jorgesys

Répondre

4

Essayez cette `

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 

    <ScrollView 
     android:layout_width="100dip" 
     android:layout_height="120dip" 
     android:background="#FF0000"> 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 


      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/scrollbar_2_text" /> 
     </LinearLayout> 
    </ScrollView> 

    <ScrollView 
     android:layout_width="100dip" 
     android:layout_height="120dip" 
     android:background="#00FF00" 
     android:paddingRight="12dip"> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/scrollbar_3_text" 
      android:textColor="#000000" 
      android:background="#60AA60" /> 
    </ScrollView> 

    <ScrollView 
     android:id="@+id/view3" 
     android:layout_width="100dip" 
     android:layout_height="120dip" 
     android:background="@android:drawable/edit_text"> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textColor="#000000" 
      android:text="@string/scrollbar_3_text" /> 
    </ScrollView> 
</LinearLayout> 

`

0

Je ne suis pas sûr que ce soit la bonne façon de le faire, mais j'Enveloppez la Parchemin dans un autre LinearLayout et définissez les fond blanc et ça a marché.