ViewBinding如何获取Fragment实例
·
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".counter.NewsContentActivity">
<fragment
android:id="@+id/newsContentFrag"
android:name="com.eastseeway.kotlinpractice.counter.NewsContentFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
在布局中使用fragment,在activity中如何获取这个fragment的实例呢?
跟普通的控件一样,使用binding.title_tv这种方式,点不出来。
更多推荐

所有评论(0)