My text in my switch
defined in a xml file won't to change it's color stay black as the activity background. I tried with the textcolor option without any success. Any ideas?
My xml file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hôte : "
android:textColor="#FFFFFF"/>
<EditText
android:background="#40FFFFFF"
android:id="@+id/hostname"
android:layout_width="200px"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Utiliser Https : "
android:textColor="#FFFFFF"/>
<Switch
android:id="@+id/Switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="on"
android:textOff="off"
android:textColor="#FFFFFF"
android:onClick="onToggleClicked"/>
</LinearLayout>
</LinearLayout>
When you create an
instance
of yourEditText
orTextView
in yourActivity
code, you can set theTextColor
, orBackground Color
for that matter, there.Ex.
For a
switch
, add this to yourstyles.xml
file:Two options:
add this to your layout
XML
file:add this to your Activity class after you've created an instance of your
switch
:Note: path to
styles.xml
file:Project Folder > res > values > styles.xml