material-components / material-components/material-components-android
[SwitchMaterial] Impossible to change textcolor which is black in day theme and white in night theme
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
I tried in code with setColor, I tried in xml, I tried in the style. Nothing works.
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchNoiseSpeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="@string/speed"
android:textOn="@string/noise"
app:layout_constraintBottom_toBottomOf="@+id/circularRangeSliderValue"
app:layout_constraintEnd_toEndOf="@+id/circularRangeSliderValue"
app:layout_constraintStart_toStartOf="@+id/circularRangeSliderValue"
app:layout_constraintTop_toTopOf="@+id/circularRangeSliderValue"
app:layout_constraintVertical_bias="0.77"
app:showText="true"
android:textColor="?attr/colorError"
/>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SwitchMaterial entry point and reproduce the XML example with showText enabled and android:textColor set to colorError. Trace how the displayed on/off text color is resolved in day and night themes; done means the configured textColor is applied in both modes, with a regression test covering the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100