2011-05-14 3 views
8

Je suis en train d'écrire un nouveau thème en copiant des parties de la Theme.Light, et je ne comprends pas ce que android: colorForeground signifie.La signification de android: colorForeground

La seule information que j'ai pu trouver est "Couleur par défaut de l'imagerie de premier plan" here mais je n'arrive toujours pas à comprendre ce que cela signifie.

Quelqu'un peut-il m'éclairer?

La mise en page que j'utilise pour le test:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:colorForeground="#80ff8000" > 

    <EditText 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="First EditText" 
     android:colorForeground="#ffffffff" /> 
    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="First TextView" 
     android:colorForeground="#ff000000" /> 

    <RelativeLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:colorForeground="#ffffffff" > 
     <EditText 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="Second EditText, inside a RelativeLayout" 
      android:colorForeground="#ff0000ff" 
      android:layout_alignParentTop="true" 
      android:layout_marginTop="10dip" /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="Second TextView, inside a RelativeLayout" 
      android:colorForeground="#ff00ff00" 
      android:layout_alignParentTop="true" /> 
    </RelativeLayout> 
</LinearLayout> 

Répondre

0

Vous pouvez voir un exemple de l'utilisation de "android: colorForeground" dans le style SwitchCompat:

styled SwitchCompat

le style (thème) pour il:

<style name="MySwitch" parent="Theme.AppCompat.Light"> 
    <!-- active thumb & track color (30% transparency) --> 
    <item name="colorControlActivated">@color/indigo</item> 

    <!-- inactive thumb color --> 
    <item name="colorSwitchThumbNormal">@color/pink</item> 

    <!-- inactive track color (30% transparency) --> 
    <item name="android:colorForeground">@color/grey</item> 
</style> 

et en appliquant:Comme vous pouvez le voir, "android: colorForeground" détermine la couleur de la piste inactive de SwitchCompat. Le thème "MySwitch" étend un thème d'activité ("Theme.AppCompat.Light") et "android: colorForeground" a été remplacé pour changer une valeur par défaut du thème d'activité.

Il s'agit donc d'un exemple d'utilisation de "android: colorForeground". Probablement il n'y a pas la seule signification ..

Ceci est l'exemple de lien: http://www.materialdoc.com/switch/