html-textview
html-textview copied to clipboard
Do not change the font.
I use the conductor framework in my project to replace fragment. I change the font in my project, but the font does not change only in the HtmlTextView.
class MainActivity : AppCompatActivity() {
private lateinit var router: Router
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
router = Conductor.attachRouter(this, container, savedInstanceState)
if (!router.hasRootController())
router.setRoot(RouterTransaction.with(HomeController()))
}
override fun onBackPressed() {
if (!router.handleBack())
super.onBackPressed()
}
}
class HomeController : Controller() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val view = inflater.inflate(R.layout.controller_home, container, false)
view.htmlTextView.setHtml("Hello <b>World</b> Hello")
return view
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<org.sufficientlysecure.htmltextview.HtmlTextView
android:id="@+id/htmlTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="24sp" />
</LinearLayout>