当我打开应用程序时,一切都很好!我可以滚动页面以显示/隐藏标题栏或页脚栏,但是当我执行某些操作(例如,删除framelayout中的所有视图,并将其他视图添加到framelayout中时),framelayout就消失了!
webFrameLayout.removeAllViews();
webFrameLayout.addView(newView);
我曾经尝试处理它,但是我做不到。我在uiautomatorviewer中看不到框架布局。
,我在coordinatorlayout中设置了一些断点。 当名为:coordinatorlayout的onlayout()方法有3个孩子时,但是在uiautomatorviewer树中,我只看到2个孩子!
框架布局不见了,有人可以帮助我吗?
我的xml是:
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/bottom_tool"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="bottom"
android:background="#FEFEFE"
android:orientation="vertical"
app:layout_behavior="inno.video.downloader.videodownloader.view.FooterBehaviorDependAppBar"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/iv_home"
style="@style/BrowserBottomToolItem"
app:srcCompat="@drawable/v_home"
/>
<FrameLayout
android:id="@+id/tab_count"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
<TextView
android:id="@+id/tv_tab_count"
android:layout_width="@dimen/tab_item_text_size"
android:layout_height="@dimen/tab_item_text_size"
android:layout_gravity="center"
android:background="@drawable/tab_background"
android:contentDescription="@null"
android:gravity="center"
android:text="1"
android:textColor="@color/icon_gray"
android:textSize="12dp"
/>
</FrameLayout>
<ImageView
android:id="@+id/iv_bookmarks"
style="@style/BrowserBottomToolItem"
app:srcCompat="@drawable/v_bookmark_border"
/>
<ImageView
android:id="@+id/iv_more"
style="@style/BrowserBottomToolItem"
app:srcCompat="@drawable/v_more_vert"
/>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="@dimen/search_bar_height"
android:background="@color/colorPrimary"
android:orientation="vertical"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_scrollFlags="scroll|enterAlways">
<include layout="@layout/search_bar"/>
<include layout="@layout/search_bar_page_search"/>
<Button
android:id="@+id/main_relayout_ok"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:text="@string/main_relayout_ok"
android:textColor="@color/white"
android:textSize="@dimen/text_size_16sp"
android:visibility="gone">
</Button>
</FrameLayout>
</android.support.design.widget.AppBarLayout>
<!--web layout-->
<!--this framelayout is gone when i add/remove views-->
<FrameLayout
android:id="@+id/web_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>