Android - Change the TextStyle of ListView items
By : user56458
Date : March 29 2020, 07:55 AM
this one helps. You can do this using a CustomAdapter for the ListView . Since the View is created from the custom data object which incudes all the cursor results. You can check if a is null and have a different textstyle for the textview Check this exercise for a custom adapter
|
How to change ActionBar Tab textStyle?
By : Durandal
Date : March 29 2020, 07:55 AM
I wish this help you To make the tab text lowercase, create a style that inherits Widget.Holo.Light.ActionBar.TabText Widget.Holo.ActionBar.TabText and set android:textAllCaps to false. You can apply your own ActionBar.Tab text style by using the android:actionBarTabTextStyle attribute. code :
<style name="Your.Theme" parent="@style/Theme.AppCompat.Light">
<item name="android:actionBarTabTextStyle">@style/Your.TabText.Style</item>
<item name="actionBarTabTextStyle">@style/Your.TabText.Style</item>
</style>
<style name="Your.TabText.Style" parent="@style/Widget.AppCompat.Light.ActionBar.TabText">
<item name="textAllCaps">false</item>
</style>
<style name="Your.TabText.Style" parent="@android:style/Widget.Holo.Light.ActionBar.TabText">
<item name="android:textAllCaps">false</item>
</style>
|
Is it possible to parse dates with both TextStyle.SHORT and TextStyle.FULL for the month?
By : Prathmesh Kalburgi
Date : March 29 2020, 07:55 AM
wish help you to fix your issue A Java 8 DateTimeFormatter created from a pattern like d. MMM u can only parse dates with the month written in the style defined by TextStyle.SHORT (e.g. 13. Feb 2015), a DateTimeFormatter created from d. MMMM u can only parse dates with the month written in the style defined by TextStyle.FULL (e.g. 13. February 2015). , You could make the different month patterns optional: code :
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d. [MMMM][MMM] u HH:mm:ss z", Locale.US);
ZonedDateTime zdt1 = ZonedDateTime.parse("4. Jan 2015 00:00:00 UTC", formatter);
ZonedDateTime zdt2 = ZonedDateTime.parse("4. January 2015 00:00:00 UTC", formatter);
System.out.println(zdt1);
System.out.println(zdt2);
2015-01-04T00:00Z[UTC]
2015-01-04T00:00Z[UTC]
|
Change TextStyle Programmatically
By : user2036521
Date : March 29 2020, 07:55 AM
I wish this helpful for you , You can use setTypeface for applying styles to your text code :
textView.setTypeface(Typeface.BOLD_ITALIC);
|
Change all UILabels for a specific UIFont.TextStyle
By : DJMax
Date : March 29 2020, 07:55 AM
wish helps you I ended up creating a subclass of UILabel and let all my labels inherit from it. This way you can set the class in InterfaceBuilder and/or create the custom class in code. This is the DynamicCustomFontLabel class: code :
import UIKit
class DynamicCustomFontLabel: UILabel {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
initCustomFont()
}
override init(frame: CGRect) {
super.init(frame: frame)
initCustomFont()
}
private func initCustomFont() {
if let textStyle = font.fontDescriptor.object(forKey: UIFontDescriptor.AttributeName.textStyle) as? UIFont.TextStyle {
let fontMetrics = UIFontMetrics(forTextStyle: textStyle)
var customFont: UIFont?
switch textStyle {
case .body:
customFont = UIFont(name: "MyAwesomeBODYFont", size: 21)
case .headline:
customFont = UIFont(name: "MyAwesomeHeadlineFont", size: 48)
// all other cases...
default:
return
}
guard let font = customFont else {
fatalError("Failed to load a custom font! Make sure the font file is included in the project and the font is added to the Info.plist.")
}
self.font = fontMetrics.scaledFont(for: font)
}
}
}
|