2011-05-14 2 views
8

기본 테마 TheLight에서 부품을 복사하여 새 테마를 쓰고 있습니다. android : colorForeground가 무엇을 의미하는지 이해할 수 없습니다.android : colorForeground의 의미

내가 찾을 수있는 유일한 정보는 "전경 이미지의 기본 색상"here이지만 여전히 의미하는 것을 이해할 수 없습니다.

나를 계몽 할 수 있습니까?

내가 테스트에 사용할 레이아웃 : 대한

styled SwitchCompat

스타일 (테마) : SwitchCompat 스타일링에 "colorForeground 안드로이드"당신의 사용의 샘플을 볼 수 있습니다

<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> 

답변

0

그것 :

<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> 

및 신청 :

<android.support.v7.widget.SwitchCompat 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:checked="true" 
    android:theme="@style/MySwitch"/> 

"android : colorForeground"는 SwitchCompat의 비활성 트랙 색상을 결정합니다.

"MySwitch"테마는 일부 활동 테마 ("Theme.AppCompat.Light")를 확장하고 "android : colorForeground"는 활동 테마에서 일부 기본값을 변경하기 위해 재정의되었습니다.

그래서 "android : colorForeground"샘플입니다. 아마도 유일한 의미는 아닙니다.

이것은 샘플 링크입니다. http://www.materialdoc.com/switch/