当前位置: 首页>>代码示例>>Java>>正文


Java WebView.setVerticalScrollBarEnabled方法代码示例

本文整理汇总了Java中android.webkit.WebView.setVerticalScrollBarEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.setVerticalScrollBarEnabled方法的具体用法?Java WebView.setVerticalScrollBarEnabled怎么用?Java WebView.setVerticalScrollBarEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.setVerticalScrollBarEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpWebView

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);
    webView.getSettings().setSaveFormData(false);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:21,代码来源:WebDialog.java

示例2: createWebView

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
public WebView createWebView(WebView webView) {

    //WebView.setWebContentsDebuggingEnabled(true);
    //不能横向滚动
    webView.setHorizontalScrollBarEnabled(false);
    //不能纵向滚动
    webView.setVerticalScrollBarEnabled(false);
    //允许截图
    webView.setDrawingCacheEnabled(true);
    //屏蔽长按事件
    webView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            return true;
        }
    });
    //初始化WebSettings
    final WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    final String ua = settings.getUserAgentString();
    settings.setUserAgentString(ua + "Latte");
    //隐藏缩放控件
    settings.setBuiltInZoomControls(false);
    settings.setDisplayZoomControls(false);
    //禁止缩放
    settings.setSupportZoom(false);
    //文件权限
    settings.setAllowFileAccess(true);
    settings.setAllowFileAccessFromFileURLs(true);
    settings.setAllowUniversalAccessFromFileURLs(true);
    settings.setAllowContentAccess(true);
    //缓存相关
    settings.setAppCacheEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setDatabaseEnabled(true);
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);

    return webView;
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:41,代码来源:WebViewInitializer.java

示例3: init

import android.webkit.WebView; //导入方法依赖的package包/类
private void init(){
    LinearLayout layout = (LinearLayout) findViewById(R.id.Download_layout);
    layout.setVisibility(View.GONE);

    Intent intent = getIntent();
    body = intent.getStringExtra("body");
    title = intent.getStringExtra("title");
    contentView = (WebView) findViewById(R.id.content_webview);
    contentView.setHorizontalScrollBarEnabled(false);//水平不显示
    contentView.setVerticalScrollBarEnabled(false); //垂直不显示

    contentView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return (event.getAction() == MotionEvent.ACTION_MOVE);
        }
    });
    contentView.setWebViewClient(new WebViewClient());

    topImage = (ImageView) findViewById(R.id.top_image);
    topTitle = (TextView) findViewById(R.id.top_titlt);
    topSource = (TextView) findViewById(R.id.top_source);
}
 
开发者ID:ChenTianSaber,项目名称:DailyZhiHu,代码行数:24,代码来源:DownloadDetaiContentActivity.java

示例4: init

import android.webkit.WebView; //导入方法依赖的package包/类
private void init(){

        Intent intent = getIntent();
        contentId = intent.getStringExtra("contentId");
        contentView = (WebView) findViewById(R.id.content_webview);
        contentView.setHorizontalScrollBarEnabled(false);//水平不显示
        contentView.setVerticalScrollBarEnabled(false); //垂直不显示

        contentView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return (event.getAction() == MotionEvent.ACTION_MOVE);
            }
        });
        contentView.setWebViewClient(new WebViewClient());

        topImage = (ImageView) findViewById(R.id.top_image);
        topTitle = (TextView) findViewById(R.id.top_titlt);
        topSource = (TextView) findViewById(R.id.top_source);
    }
 
开发者ID:ChenTianSaber,项目名称:DailyZhiHu,代码行数:21,代码来源:DetaiContentActivity.java

示例5: setUpWebView

import android.webkit.WebView; //导入方法依赖的package包/类
private void setUpWebView() {
    mSpinner = new ProgressDialog(this);

    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");

    mWebView = new WebView(this);

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new InstagramWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mAuthUrl);
    mWebView.setLayoutParams(FILL);

    WebSettings webSettings = mWebView.getSettings();

    webSettings.setSavePassword(false);
    webSettings.setSaveFormData(false);
    clearCache();


    addContentView(mWebView,FILL);
}
 
开发者ID:inceleb,项目名称:InstagramManager-Android,代码行数:25,代码来源:LoginActivity.java

示例6: setUpWebView

import android.webkit.WebView; //导入方法依赖的package包/类
/**
 * Creating webview for instagram dialog login
 */

private void setUpWebView() {
  mWebView = new WebView(getContext());
  mWebView.setVerticalScrollBarEnabled(false);
  mWebView.setHorizontalScrollBarEnabled(false);
  mWebView.setWebViewClient(new OAuthWebViewClient());
  mWebView.getSettings().setJavaScriptEnabled(true);
  mWebView.loadUrl(mUrl);
  mWebView.setLayoutParams(FILL);
  mContent.addView(mWebView);
}
 
开发者ID:mukeshsolanki,项目名称:social-login-helper,代码行数:15,代码来源:InstagramDialog.java

示例7: initSetting

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint({"JavascriptInterface"})
public void initSetting(WebView webView, Context context) {
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setUserAgentString(LetvUtils.createUA(webView.getSettings().getUserAgentString()));
    webView.setVerticalScrollBarEnabled(true);
    webView.setHorizontalScrollBarEnabled(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.addJavascriptInterface(new GetShareDesc(), "getShareDesc");
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:LetvBaseWebViewActivity.java

示例8: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override
/**
 * When the dialog is created, we add the webview and load the authorize url.
 */
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	
	mProgress = new ProgressDialog(getContext());
	mProgress.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mProgress.setMessage("Loading...");
	
	mLayout = new LinearLayout(getContext());
	mLayout.setOrientation(LinearLayout.VERTICAL);

	mWebView = new WebView(getContext());
	mWebView.setVerticalScrollBarEnabled(false);
	mWebView.setHorizontalScrollBarEnabled(false);
	//mWebView.getSettings().setSupportZoom(false);
	mWebView.setLayoutParams(MATCH);
	mWebView.getSettings().setJavaScriptEnabled(true);

	mWebView.setWebViewClient(new OAuthWebViewClient());
       mWebView.setWebChromeClient(new WebChromeClient());
       
       mWebView.loadUrl(mReq.getLocationUri());
       mLayout.addView(mWebView);
       
       Display display = getWindow().getWindowManager().getDefaultDisplay();
	addContentView(mLayout, new FrameLayout.LayoutParams(display.getWidth() - 20, display.getHeight() - 20));
	CookieSyncManager.createInstance(getContext());
	CookieManager cookieManager = CookieManager.getInstance();
	cookieManager.removeAllCookie();
	
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:39,代码来源:OAuthDialog.java

示例9: setUpWebView

import android.webkit.WebView; //导入方法依赖的package包/类
private void setUpWebView() {
    mWebView = new WebView(getContext());

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new TwitterWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mUrl);
    mWebView.setLayoutParams(FILL);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");

    mContent.addView(mWebView);
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:15,代码来源:TwitterDialog.java

示例10: setUpWebView

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView() {
    mWebView = new WebView(getContext());
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new FoursquareDialog.FoursquareWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mUrl);
    mWebView.setLayoutParams(FILL);
    mContent.addView(mWebView);
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:12,代码来源:FoursquareDialog.java

示例11: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled"})
@Override
public void onCreate() {
    super.onCreate();

    mWebView = new WebView(this);
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setBackgroundColor(Color.TRANSPARENT);
    mWebView.getSettings().setJavaScriptEnabled(true);
    {
        mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

        mHideParams = newLayoutParams(1);

        final DisplayMetrics metrics = getResources().getDisplayMetrics();
        final int min = Math.min(metrics.heightPixels, metrics.widthPixels);

        mPlayerSize = (int) (min / metrics.density);

        mParams = newLayoutParams(min);
        mParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
        mParams.y = getTopY(metrics);
    }
    final IntentFilter filter = new IntentFilter();
    filter.addAction(ServiceAction.STOP);
    filter.addAction(ServiceAction.SHOW);
    filter.addAction(ServiceAction.HIDE);

    LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver = newBroadcastReceiver(), filter);
}
 
开发者ID:RollnCode,项目名称:BackTube,代码行数:32,代码来源:PlayerService.java

示例12: initWebView

import android.webkit.WebView; //导入方法依赖的package包/类
public void initWebView(WebView webView) {
        webView.setVerticalScrollBarEnabled(false);
        webView.setBackgroundColor(getResources().getColor(R.color.white));
        //设置webview的配置
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
                | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

        WebSettings webseting = webView.getSettings();
        // 支持JavaScript
        webseting.setJavaScriptEnabled(true);
        // 支持保存数据
        webseting.setSaveFormData(false);
        webseting.setDomStorageEnabled(true);
//		webseting.setAppCacheMaxSize(1024 * 1024 * 8);// 设置缓冲大小,我设的是8M
        String appCacheDir = getApplicationContext().getDir("cache", Context.MODE_PRIVATE).getPath();
        webseting.setAppCachePath(appCacheDir);
        webseting.setUserAgentString(Config.FORMAT_USER_AGENT);
        webseting.setLoadWithOverviewMode(true);
        webseting.setUseWideViewPort(true);
        webseting.setDatabaseEnabled(true);
        webseting.setAllowFileAccess(true);
        webseting.setCacheMode(WebSettings.LOAD_DEFAULT);
        /*强制webview使用标准字号大小*/
        webseting.setTextZoom(100);

        // webseting.setBlockNetworkImage(true);
        webseting.setLoadsImagesAutomatically(true);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            webView.setWebContentsDebuggingEnabled(true);// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application.
        }

        //移除webkit内部存在安全漏洞的javascript接口
        webView.removeJavascriptInterface("searchBoxJavaBridge_");
        webView.removeJavascriptInterface("accessibility");
        webView.removeJavascriptInterface("accessibilityTraversal");

    }
 
开发者ID:AlpacaNotSheep,项目名称:hybrid,代码行数:38,代码来源:BaseWebActivity.java

示例13: showWhatsNewBox

import android.webkit.WebView; //导入方法依赖的package包/类
public void showWhatsNewBox()	{
	AlertDialog.Builder blder = new AlertDialog.Builder(this);
	blder.setIcon(R.drawable.icon);
	blder.setTitle(getString(R.string.whats_new));
       LayoutInflater factory = LayoutInflater.from(this);
       View vWhatsNew = factory.inflate(R.layout.whats_new, null);
       WebView webviewWhatsNew = (WebView)vWhatsNew.findViewById(R.id.webviewWhatsNew);
       webviewWhatsNew.setVerticalScrollBarEnabled(true);
       webviewWhatsNew.setHorizontalScrollBarEnabled(true);
    webviewWhatsNew.getSettings().setBuiltInZoomControls(true);
       Locale l = Locale.getDefault();  
    String strLanguage = String.format("%s-%s", l.getLanguage(), l.getCountry());
    String strIndexAddr;
    if (strLanguage.equals("zh-CN") || strLanguage.equals("zh-SG"))	{
    	strIndexAddr = "file:///android_asset/zh-CN/" + WHATS_NEW_FILE_PATH + ".html";
    } else if (strLanguage.equals("zh-TW") || strLanguage.equals("zh-HK"))	{
	    	strIndexAddr = "file:///android_asset/zh-TW/" + WHATS_NEW_FILE_PATH + ".html";
    } else	{
    	strIndexAddr = "file:///android_asset/en/" + WHATS_NEW_FILE_PATH + ".html";
    	strLanguage = "en";
    }
    webviewWhatsNew.loadUrl(strIndexAddr);
	blder.setView(vWhatsNew);
	blder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
		
		@Override
		public void onClick(DialogInterface dialog, int which) {
		}
	});
	blder.setCancelable(false);
	AlertDialog alertWhatsnewDlg = blder.create();
	alertWhatsnewDlg.show();
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:34,代码来源:ActivitySmartCalc.java

示例14: setUpWebView

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext().getApplicationContext()) {
        /* Prevent NPE on Motorola 2.2 devices
         * See https://groups.google.com/forum/?fromgroups=#!topic/android-developers/ktbwY2gtLKQ
         */
        @Override
        public void onWindowFocusChanged(boolean hasWindowFocus) {
            try {
                super.onWindowFocusChanged(hasWindowFocus);
            } catch (NullPointerException e) {
            }
        }
    };
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);
    webView.getSettings().setSaveFormData(false);
    webView.setFocusable(true);
    webView.setFocusableInTouchMode(true);
    webView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (!v.hasFocus())
            {
                v.requestFocus();
            }
            return false;
        }
    });

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:44,代码来源:WebDialog.java

示例15: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_moodle);
    Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    webView = (WebView) findViewById(R.id.web_moodle);
    webSettings = webView.getSettings();
    webSettings.setAppCacheEnabled(true);
    //webSettings.setCacheMode(webSettings.LOAD_CACHE_ELSE_NETWORK);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setAllowFileAccess(true);
    webView.setVerticalScrollBarEnabled(false);
    webView.getSettings().setDomStorageEnabled(true);
    webView.setHorizontalScrollBarEnabled(false);
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
    CookieManager.getInstance().setAcceptCookie(true);
    //final SharedPreferences profile = getSharedPreferences("userdata", 0);
    webView.setWebViewClient(new PQClient());
    webView.setWebChromeClient(new PQChromeClient());
    //if SDK version is greater of 19 then activate hardware acceleration otherwise activate software acceleration
    if (Build.VERSION.SDK_INT >= 19) {
        webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
    else if(Build.VERSION.SDK_INT >=11 && Build.VERSION.SDK_INT < 19) {
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

    webView.loadUrl("http://moodle.coep.org.in/moodle/login/index.php");
    webView.setDownloadListener(new DownloadListener() {

        @Override
        public void onDownloadStart(String url, String userAgent,
                                    String contentDisposition, String mimetype,
                                    long contentLength) {
            try {
                DownloadManager.Request request = new DownloadManager.Request(
                        Uri.parse(url));
            /* Let's have some Cookies !!!*/
                String cookies = CookieManager.getInstance().getCookie(url);
                request.addRequestHeader("cookie", cookies);
                //Yummy !!
                request.allowScanningByMediaScanner();
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
                final String filename = URLUtil.guessFileName(url, contentDisposition, mimetype);
                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
                DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
                dm.enqueue(request);
                makeText(getApplicationContext(), "Downloading File", //To notify the Client that the file is being downloaded
                        Toast.LENGTH_LONG).show();
            }
            catch(SecurityException e)
            {
                Toast.makeText(getApplicationContext(),"Please grant the storage permission !",Toast.LENGTH_LONG).show();
            }

        }
    });
}
 
开发者ID:ashutoshbsathe,项目名称:COEP-Moodle-via-Webview,代码行数:62,代码来源:Moodle.java


注:本文中的android.webkit.WebView.setVerticalScrollBarEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。