0

This is my base theme for application:

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorSecondaryLight</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:buttonStyle">@style/NormalButtonStyle</item> <item name="buttonStyle">@style/NormalButtonStyle</item> </style> 

And this is NormalButtonStyle:

 <style name="NormalButtonStyle" parent="@style/Widget.AppCompat.Button"> <item name="android:textColor">@android:color/white</item> <item name="fontPath">fonts/TitilliumWeb-SemiBold</item> <item name="android:backgroundTint">@color/colorAccent</item> <item name="android:colorButtonNormal">@color/progressBar</item> <item name="android:textAllCaps">true</item> <item name="android:colorControlHighlight">@color/colorSecondaryLight</item> <item name="colorControlHighlight">@color/colorSecondaryLight</item> </style> 

Here fontPath is attribute of Calligraphy library. But it is not working for me.

This is one of the AppCompatButton Code:

<android.support.v7.widget.AppCompatButton android:id="@+id/btnLoginSignIn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="@string/txt_sign_in" android:layout_below="@id/tilLoginPassword" android:layout_marginTop="@dimen/dimen_top_margin_normal" android:layout_alignStart="@id/tilLoginPassword" android:layout_alignEnd="@id/tilLoginPassword"/> 

What am I doing wrong?

Android Manifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.astound.farmroster"> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:name=".app.MyApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".activity.Splash" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBarFullScreen" android:windowSoftInputMode="adjustResize|stateHidden"> </activity> <activity android:name=".activity.Login" android:label="@string/txt_sign_in" android:screenOrientation="portrait" android:windowSoftInputMode="adjustResize|stateHidden"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".activity.Dashboard" android:label="@string/title_activity_dashboard" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="adjustResize|stateHidden"> </activity> <activity android:name=".activity.JobList" android:label="@string/title_activity_job_list" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="adjustResize|stateHidden"> </activity> <activity android:name=".activity.JobDetail" android:label="@string/title_activity_job_detail" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="adjustResize|stateHidden"> </activity> </application> </manifest> 
4
  • Can you add AndroidManifest.xml to your post? Commented May 27, 2017 at 11:21
  • Hey @fisher3421 I did Commented May 27, 2017 at 11:23
  • 1
    try with the file extension...<item name="fontPath">fonts/TitilliumWeb-SemiBold.ttf</item> Commented May 27, 2017 at 11:28
  • Thanks @rafsanahmad007 It worked. I just wanted to know one more thing: <item name="android:colorControlHighlight">@color/colorSecondaryLight</item> <item name="colorControlHighlight">@color/colorSecondaryLight</item> Which one is right? Commented May 27, 2017 at 11:42

2 Answers 2

2

Use the Full file path with Extension:

instead of:

<item name="fontPath">fonts/TitilliumWeb-SemiBold</item> 

use:

<item name="fontPath">fonts/TitilliumWeb-SemiBold.ttf</item> 

Regarding your Second Question: Both are Right.

<item name="android:colorControlHighlight">@color/colorSecondaryLi‌​ght</item> <item name="colorControlHighlight">@color/colorSecondaryLight</ite‌​m> 

Usage example

theme.xml:

<item name="colorControlHighlight">@color/button_color</item> 

v21/theme.xml

<item name="android:colorControlHighlight">@color/button_color</item> 

For More Help See this Answer

Sign up to request clarification or add additional context in comments.

Comments

0

add full file name to "fontPath" attribute in your style like:

<item name="fontPath">fonts/TitilliumWeb-SemiBold.ttf</item>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.