I'm writing a new theme by copying parts from the builtin Theme.Light, and I don't understand what android:colorForeground means.
The only info I could find is "Default color of foreground imagery" here but I still can't understand what it means.
Can someone please enlighten me?
The layout I use for testing:
<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>
attr/colorControlActivated The color applied to icons/controls in their activated state (e.g. checked).
android:windowIsFloating is used to indicate whether the current window is floating or not. android:backgroundDimEnabled is used to indicate whether the dimming behind the window is enabled or not.
You can see a sample of usage of "android:colorForeground" in SwitchCompat styling:
the style (theme) for it:
<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>
and applying:
<android.support.v7.widget.SwitchCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:theme="@style/MySwitch"/>
As you can see, "android:colorForeground" determine inactive track color of SwitchCompat.
"MySwitch" theme extends some activity theme ("Theme.AppCompat.Light") and "android:colorForeground" was overrided to change some default value from the activity theme.
So it's a sample of "android:colorForeground" use. Probably there is not the only meaning..
This is the sample link: http://www.materialdoc.com/switch/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With