Android 为什么使用WebView加载web时颜色会变暗?
当我的应用程序在Android Studio内的WebView组件上加载URL时,所有图像的颜色都变暗,如本视频()。颜色就像盲色,我不修改图像的效果,所以我不知道它的变化。 这是我的代码: “Layout.xml” 谢谢Android 为什么使用WebView加载web时颜色会变暗?,android,android-studio,android-layout,Android,Android Studio,Android Layout,当我的应用程序在Android Studio内的WebView组件上加载URL时,所有图像的颜色都变暗,如本视频()。颜色就像盲色,我不修改图像的效果,所以我不知道它的变化。 这是我的代码: “Layout.xml” 谢谢 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="ExtraText">
<ImageView
android:id="@+id/imageView"
android:layout_width="418dp"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/fondo_gladoop"
tools:layout_editor_absoluteY="49dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="52dp"
tools:layout_editor_absoluteX="-1dp"
tools:layout_editor_absoluteY="52dp">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/youtube_view"/>
</RelativeLayout>
<include
android:id="@+id/include"
layout="@layout/custom_appbar" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="54dp"
android:layout_marginLeft="0dp"
android:background="@drawable/borde_rojo_barratitulo"
android:gravity="left"
android:id="@+id/toolbar"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_marginRight="-9dp"
android:src="@drawable/ic_menu_black_24dp"
android:id="@+id/icono_menu"/>
<ImageView
android:layout_width="60dp"
android:layout_height="46dp"
android:src="@drawable/gladoop"
android:id="@+id/logo_gladoop_toolbar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="51dp"
android:layout_height="46.5dp"
android:src="@drawable/palomitas"
android:id="@+id/palomitas_menu"/>
<ImageView
android:layout_width="60dp"
android:layout_height="50.5dp"
android:layout_marginTop="-2dp"
android:layout_marginLeft="-5dp"
android:src="@drawable/campana"
android:id="@+id/campana_menu"/>
<ImageView
android:layout_width="51dp"
android:layout_height="47.5dp"
android:layout_marginRight="4dp"
android:layout_marginLeft="-7dp"
android:src="@drawable/compartir"
android:id="@+id/compartir_menu"/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
package gladoop.javir3tics.test;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class YouTube extends AppCompatActivity {
private WebView mWebview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_youtube);
mWebview = findViewById(R.id.youtube_view);
WebSettings conf = mWebview.getSettings();
conf.setJavaScriptEnabled(true);
mWebview.setWebViewClient(new WebViewClient());
mWebview.loadUrl("https://youtube.com/gladoop");
}
}