为什么我不能全屏

时间:2017-01-17 08:15:25

标签: java android video webview web

观看视频时,网页视图上没有全屏按钮,原因是什么?

我不会去帮助这些事情。

对不起我的英语

MainActivity.java

package net.aniplus.aniplus;

import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        webView = (WebView) findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setSupportZoom(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.loadUrl("http://youtube.com");


        final ProgressDialog progressDialog=ProgressDialog.show(this, "Mobil Video İzle", "Bağlantınız Kontrol Ediliyor", true);
        progressDialog.show();

        webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                Toast.makeText(MainActivity.this, "", Toast.LENGTH_SHORT).show();
                progressDialog.dismiss();
            }

            @Override
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                super.onReceivedError(view, errorCode, description, failingUrl);

                Toast.makeText(MainActivity.this, "Bir hata oluştur!", Toast.LENGTH_SHORT);
                progressDialog.dismiss();
            }
        });


    }
}

activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="net.aniplus.aniplus.MainActivity">

    <WebView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/webView" />
</RelativeLayout>
 

我正在尝试几个小时,但我没有让它工作:(

1 个答案:

答案 0 :(得分:0)

在android清单上更改或添加Activity的主题。

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"