扩展程序是否具有调用膨胀视图的魔力?据我所知,我应该打破代码的和谐并调用findViewById
意图是在某个时候夸大layout_ongoingView
布局,并根据场景再次隐藏和显示
<ViewStub
android:id="@+id/viewStubOngoing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/ongoingView"
android:layout="@layout/layout_ongoingView" />
和代码
override fun hideOngoingPanel() {
if (viewStubOngoing !is ViewStub) {
findViewById(R.id.ongoingView).visibility = View.GONE
}
}
override fun showOngoingPanel() {
if (viewStubOngoing !is ViewStub) {
findViewById(R.id.ongoingView).visibility = View.VISIBLE
} else {
viewStubOngoing.inflate()
}
}