Using Webview as AndroidViewFilterRender not filling entire screen when activity in "Landscape Mode".
Hi @pedroSG94, we tried with webview as overlay filter but its not showing full screen in landscape mode.
Here is my code
//Main Activity Layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextureView
android:id="@+id/textureView"
android:layout_width="match_parent"
android:layout_height="match_parent"></TextureView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/overlay_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible">
</WebView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:orientation="vertical">
<ImageView
android:id="@+id/b_start_stop"
android:layout_width="98dp"
android:layout_height="98dp"
android:src="@drawable/stream_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/bitrate_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:textColor="@color/teal_200"
android:textSize="36sp" />
</LinearLayout>
// Inflate Views from xml
stream_start_stop = findViewById(R.id.b_start_stop) bitrate_tv = findViewById(R.id.bitrate_tv) overlay_webview = findViewById(R.id.overlay_webview);
//web view intialization
overlay_webview.setBackgroundColor(Color.TRANSPARENT); overlay_webview.getSettings().setJavaScriptEnabled(true); overlay_webview.getSettings().setLoadWithOverviewMode(true); overlay_webview.getSettings().setUseWideViewPort(true); overlay_webview.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView?,
request: WebResourceRequest?
): Boolean {
view?.loadUrl(request?.url.toString());
return true
}
override fun onPageFinished(view: WebView?, url: String?) {
}
}
overlay_webview.loadUrl("https://www.youtube.com/")
//adding webview as filter
textureView = findViewById(R.id.textureView); if (!genericStream.isOnPreview) genericStream.startPreview(textureView, true) val androidViewFilterRender = AndroidViewFilterRender() androidViewFilterRender.view = overlay_webview androidViewFilterRender.setPosition(0f, 0f) genericStream.getGlInterface().addFilter(androidViewFilterRender)
Output Image
AndroidViewFilterRender not matches entire sceen.
Hello,
I can't see set the scale to 100x100 (androidViewFilterRender.setScale(100f, 100f)).
Thanks @pedroSG94