Closed ohmp closed 7 years ago
Make sure you are using the latest versions of the design library, they have changed it so those views are inflated now, not created pragmatically.
Reopening I was wrong, it 22.2.+ allows for Custom Layouts, but still applies the tabTextAppearance
after inflation.
As a temporary workaround, one can use what's described in #180:
final Typeface typeface = TypefaceUtils.load(context.getAssets(), "fonts/Roboto-Regular.ttf");
CalligraphyTypefaceSpan typefaceSpan = new CalligraphyTypefaceSpan(typeface);
SpannableString spannable = new SpannableString(myText);
spannable.setSpan(typefaceSpan, 0, myText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
(bug described in #180 still exists, tab titles cannot be set with the tabTextAppearance
attribute)
@chrisjenx Please consider changing the title, and/or linking relevant item from b.android.com etc - and what youre reccomended work around is - e.g. can it be done in xml at all as of today?
@chrisjenx @RomainPiel @ohmp So can i confirm - it is NOT working at this time with TabLayout via xml?
So, using a custom XML and applying it will. Using the built in tabs it won't. I thought the update applied the XML appearance to the supplied XML
On Mon, 18 Jan 2016, 17:02 Neil Jay Warner notifications@github.com wrote:
@chrisjenx https://github.com/chrisjenx @RomainPiel https://github.com/RomainPiel @ohmp https://github.com/ohmp So can i confirm - it is NOT working at this time with TabLayout via xml?
— Reply to this email directly or view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/201#issuecomment-172591096 .
Has anyone got it working inside a thin custom control overriding TabLayout? overriding newTab or something for a more robust solution ?
@neiljaywarner If you use: https://developer.android.com/reference/android/support/design/widget/TabLayout.Tab.html#setCustomView(int) whilst creating tabs and apply the fontPath
to the supplied xml, that will work, just a pain.
Me and Romain we're discussing a more permanent solution.
Romain's fix also works if you'd like to set the font of the error text.
passwordTextInputLayout.setError(wrapInCustomfont(getString(R.string.error_password_blank)));
private Spannable wrapInCustomfont(String myText) {
final Typeface typeface = TypefaceUtils.load(getAssets(), getString(R.string.font_path_regular));
CalligraphyTypefaceSpan typefaceSpan = new CalligraphyTypefaceSpan(typeface);
SpannableString spannable = new SpannableString(myText);
spannable.setSpan(typefaceSpan, 0, myText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannable;
}
Here's my workaround for setting the hintTextAppearance attribute - its a custom class that extends TextInputLayout https://gist.github.com/kassim/398437f93474936c49f600e90781a495
Here is my own workaround for this. I only needed the default Calligraphy font. https://gist.github.com/timkrins/845310be17aa0b804f0db5e8bd035484
is this fixed now?
I don't think so I think he found a work around.
On Sun, 4 Jun 2017, 11:23 kassim, notifications@github.com wrote:
is this fixed now?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/201#issuecomment-306031434, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHRsb12H-X3jWJ3uCeyiPjkVm_V6kpiks5sAoWNgaJpZM4FsatH .
Thanks to @scottyab, I create a customize class based on his idea for convenience https://gist.github.com/thanhbinh84/c36f930c1978e4f0d949c8f9a7662495
Everything is woking fine for all the component but it is not changing error font and hint of TextInputLayout. As well For TabLayout text font also not changing.
Please help me to fix this issue...