Reputation: 1916
I am trying to upgrade my app to support Material design on pre-lollipop devices, for this i have added android support library v7 and changed my app's style from android:Theme.Holo.Light.DarkActionBar
to Theme.AppCompat.NoActionBar
. Now my MainActivity
extends ActionBarActivity
of support library along with this I have changed my action bar to tool bar.
Till here all work good and it shows new drawer toggle icon with animation but in my entire app all text color has been changed from Black
to White
and now I have no clue from where I have to change. Do I have to change it in my every layout?
I am using Android studio with following configuration.
Build.gradle
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
}
dependencies {
compile "com.android.support:appcompat-v7:21.0.+"
}
Style.xml
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">false</item>
</style>
Layout.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/TopLevelActivity">
<LinearLayout
android:id="@+id/layout"
style="@style/Default"
android:orientation="vertical">
<TextView
android:id="@+id/name_label"
style="@style/SectionHeader.First"
android:text="@string/name"/>
<TextView
android:id="@+id/name"
style="@style/Text.SingleLine" />
<TextView
android:id="@+id/email_label"
style="@style/SectionHeader"
android:text="@string/email" />
<TextView
android:id="@+id/email"
style="@style/Text.SingleLine" />
<TextView
android:id="@+id/app_version_label"
style="@style/SectionHeader"
android:text="@string/app_version" />
<TextView
android:id="@+id/app_version"
style="@style/Text.SingleLine" />
<TextView
android:id="@+id/customer_support_label"
style="@style/SectionHeader"
android:visibility="gone"
android:text="@string/customer_support" />
<TextView
android:id="@+id/customer_support_phone"
style="@style/Text.SingleLine"
android:visibility="gone"
android:autoLink="all" />
<TextView
android:id="@+id/customer_support_email"
style="@style/Text.SingleLine"
android:visibility="gone"
android:autoLink="all" />
<Switch
android:id="@+id/alarm_service_toggle"
android:layout_marginTop="@dimen/small_padding"
style="@style/Default" />
<TextView
style="@style/Text.SingleLine"
android:textColor="@android:color/tertiary_text_light"
android:text="@string/switch_location_sub_message" />
<Button
android:id="@+id/capture_logs"
style="@style/Default"
android:layout_marginTop="@dimen/medium_padding"
android:text="@string/capture_logs" />
<Button
android:id="@+id/logout"
style="@style/Default"
android:layout_marginTop="@dimen/medium_padding"
android:text="@string/logout" />
</LinearLayout>
</ScrollView>
Please let me know if any other inputs are required from me.
Upvotes: 0
Views: 1438
Reputation: 46
Use Theme.AppCompat.Light.NoActionBar
instead of Theme.AppCompat.NoActionBar
.
Upvotes: 3
Reputation: 795
In theme you have to define text color
OR
SetTextColor(Color.colorname);
from java at run time
OR
in xml android:textColor="#color code"
Upvotes: 1