What is android.widget.FrameLayout

坚强是说给别人听的谎言 提交于 2019-12-11 05:53:41

问题


I have a simple App, Layout XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <WebView
        android:id="@+id/webview"
        android:layout_width="200dp"
        android:layout_height="200dp" />
</RelativeLayout>

When I use following code:

WebView webview = (WebView)findViewById(R.id.webview);
webview.getRootView().findViewById(android.R.id.content);

webview.getRootView().findViewById(android.R.id.content); return android.widget.FrameLayout.What is it? I never define FrameLayout in my app.Is that provided by Android by default?


回答1:


I think this question (although closed) answers it.

Difference between findViewById(R.id.content) and getRootView()

Check out the Hierarchy Viewer tool. If it very helpful for debugging your layouts. It will show you the entire tree of all the views in your Activity. At the root of almost every Activity is a FrameLayout I believe.




回答2:


FrameLayout is used internally by the WebView.



来源:https://stackoverflow.com/questions/12335578/what-is-android-widget-framelayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!