[英]What is the best way to justify TextView in Kotlin?
在 Kotlin 中證明 TextView(使用 LTR 和 RTL)的最佳方法是什么?
我嘗試了很多庫,例如:
implementation 'com.codesgood:justifiedtextview:1.1.0'
implementation 'me.biubiubiu.justifytext:library:1.1'
implementation 'com.github.bluejamesbond:textjustify-android:2.1.6'
implementation 'com.github.pouriaHemmati:JustifiedTextView:1.0.0'
但它們並不是完美的解決方案。
在 Kotlin 中,對齊 TextView 中文本的最佳方法是結合使用 gravity 屬性和 textAlignment 屬性。
val textView = findViewById<TextView>(R.id.text_view)
textView.gravity = Gravity.END
textView.textAlignment = View.TEXT_ALIGNMENT_VIEW_END
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.