SuperBrowser简单游览器Android

                               SuperBrowser简单游览器Android

1.AndroidManifest.xml

SuperBrowser简单游览器Android_第1张图片




    

    
        
            
                

                
            
            
                

                
                

                
                
                
                
            
        
    

2.新建 SuperBrowser\app\src\main\res\xml




    


3.MainActivity.java

package com.glsite.superbrowser;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

    private EditText mEtPath;
    private ImageView mIvGo;
    private WebView mWv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mEtPath = findViewById(R.id.et_path);
        mIvGo = findViewById(R.id.iv_go);
        mWv = findViewById(R.id.wv);

        Intent intent = getIntent();
        if (intent != null) {
            if (intent.getData() != null) {
                String path = intent.getData().toString();
                mWv.loadUrl(path);
                mEtPath.setText(path);
            }
        }

        mIvGo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String path =  mEtPath.getText().toString().trim();
                mWv.loadUrl(path);
            }
        });
    }
}

 

你可能感兴趣的:(java,android,SuperBrowser,游览器,Android)