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


Java WebView.setId方法代码示例

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


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

示例1: createRefreshableView

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected WebView createRefreshableView(Context context, AttributeSet attrs)
{
	WebView webView = new WebView(context, attrs);
	
	webView.setId(R.id.srWebview);
	return webView;
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:9,代码来源:SwipeRefreshWebView.java

示例2: drawInnerViews

import android.webkit.WebView; //导入方法依赖的package包/类
private void drawInnerViews(Context context, AttributeSet attrs){
    float density = context.getResources().getDisplayMetrics().density;
    int value16 = (int)(16*density);
    int value10 = (int)(10*density);
    int value40 = (int)(40*density);
    LayoutParams mainLayoutParams = new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    mainLayoutParams.setMargins(value16,value16,value16,value16);
    setLayoutParams(mainLayoutParams);

    //creation & addition of webview
    webview = new WebView(context, attrs);
    webview.setId(android.R.id.content);
    webview.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(value10,value40,0,0)
                    .create()
    );
    webview.getSettings();
    webview.setBackgroundColor(Color.argb(0,0,0,0));
    addView(webview);

    //creation of list view
    listView = new ListView(context, attrs);
    listView.setId(android.R.id.list);
    listView.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(0,value10,0,0)
                    .addRule(BELOW, webview.getId() )
                    .create()
    );
    addView(listView );

    //creation & addition of editText
    editTv = new AppCompatEditText(context, attrs);
    editTv.setVisibility(GONE);
    editTv.setId(android.R.id.text1);
    editTv.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(value10, value10, 0, 0)
                    .addRule(BELOW, webview.getId())
                    .create()
    );
    editTv.setInputType(InputType.TYPE_CLASS_TEXT);
    editTv.setImeOptions(EditorInfo.IME_ACTION_DONE);
    addView(editTv );

}
 
开发者ID:alfredayibonte,项目名称:QuestionnaireView,代码行数:55,代码来源:QuestionnaireView.java

示例3: LightningView

import android.webkit.WebView; //导入方法依赖的package包/类
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) {
    BrowserApp.getAppComponent().inject(this);
    mActivity = activity;
    mUIController = (UIController) activity;
    mWebView = new WebView(activity);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
        mWebView.setId(View.generateViewId());
    }
    mIsIncognitoTab = isIncognito;
    mTitle = new LightningViewTitle(activity);

    sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity();

    mWebView.setDrawingCacheBackgroundColor(Color.WHITE);
    mWebView.setFocusableInTouchMode(true);
    mWebView.setFocusable(true);
    mWebView.setDrawingCacheEnabled(false);
    mWebView.setWillNotCacheDrawing(true);
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
        //noinspection deprecation
        mWebView.setAnimationCacheEnabled(false);
        //noinspection deprecation
        mWebView.setAlwaysDrawnWithCacheEnabled(false);
    }
    mWebView.setBackgroundColor(Color.WHITE);

    mWebView.setScrollbarFadingEnabled(true);
    mWebView.setSaveEnabled(true);
    mWebView.setNetworkAvailable(true);
    mWebView.setWebChromeClient(new LightningChromeClient(activity, this));
    mWebView.setWebViewClient(new LightningWebClient(activity, this));
    mWebView.setDownloadListener(new LightningDownloadListener(activity));
    mGestureDetector = new GestureDetector(activity, new CustomGestureListener());
    mWebView.setOnTouchListener(new TouchListener());
    sDefaultUserAgent = mWebView.getSettings().getUserAgentString();
    initializeSettings();
    initializePreferences(activity);

    if (url != null) {
        if (!url.trim().isEmpty()) {
            mWebView.loadUrl(url, mRequestHeaders);
        } else {
            // don't load anything, the user is looking for a blank tab
        }
    } else {
        loadHomepage();
    }
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:49,代码来源:LightningView.java


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