Android 在framelayout中添加两个webview
我想在布局中添加两个webview。我使用frameLayoutAndroid 在framelayout中添加两个webview,android,webview,android-framelayout,Android,Webview,Android Framelayout,我想在布局中添加两个webview。我使用frameLayout <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orient
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/webview1"
android:layout_width="350dip"
android:layout_height="350dip" />
<WebView
android:layout_height="250dip"
android:layout_width="250dip"
android:id="@+id/webview2"
/>
</FrameLayout>
但当运行project时,它只显示webview youtube全屏..我想同时显示两个webview..我必须做什么???使用另一个布局,a仅用于显示单个子元素
我建议使用线性布局并指定权重,以将视图划分为所需的比例 使用Framelayout时需要记住的一件事是,“向Framelayout添加多个视图时,每个视图都将堆叠在前一个视图的顶部。”因此,最好使用任何其他父级布局,如线性布局或相对布局,即使用两个Framelayout 代码:
</RelativeLayout>
<?xml version=”1.0” encoding=”utf-8”?>
<RelativeLayout
android:id=”@+id/RLayout”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
xmlns:android=”http://schemas.android.com/apk/res/android”>
<FrameLayout>
<WebView
android:id="@+id/webview1"
android:layout_width="350dip"
android:layout_height="350dip" />
</FrameLayout>
<FrameLayout>
<WebView
android:layout_height="250dip"
android:layout_width="250dip"
android:id="@+id/webview2" />
</FrameLayout>
</RelativeLayout>
</RelativeLayout>
<?xml version=”1.0” encoding=”utf-8”?>
<RelativeLayout
android:id=”@+id/RLayout”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
xmlns:android=”http://schemas.android.com/apk/res/android”>
<FrameLayout>
<WebView
android:id="@+id/webview1"
android:layout_width="350dip"
android:layout_height="350dip" />
</FrameLayout>
<FrameLayout>
<WebView
android:layout_height="250dip"
android:layout_width="250dip"
android:id="@+id/webview2" />
</FrameLayout>
</RelativeLayout>