本文整理汇总了Java中android.webkit.WebSettings.LayoutAlgorithm类的典型用法代码示例。如果您正苦于以下问题:Java LayoutAlgorithm类的具体用法?Java LayoutAlgorithm怎么用?Java LayoutAlgorithm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutAlgorithm类属于android.webkit.WebSettings包,在下文中一共展示了LayoutAlgorithm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private void initView() {
this.tvBind.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
MobclickAgent.onEvent(ScaleIntroActivity.this, Event.bingo_clickBindingScalse);
ScaleBindActivity.startActivity(ScaleIntroActivity.this);
}
});
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
this.webView.getSettings().setPluginState(PluginState.ON);
this.webView.getSettings().setUserAgentString(this.webView.getSettings()
.getUserAgentString() + " App/boohee");
this.webView.getSettings().setDomStorageEnabled(true);
this.webView.setWebViewClient(createWebViewClient());
this.webView.loadUrl(UrlUtils.handleUrl(URL));
}
示例2: initWebView
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled"})
private void initWebView() {
this.webview.getSettings().setJavaScriptEnabled(true);
this.webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
this.webview.setVerticalScrollBarEnabled(false);
this.webview.setVerticalScrollbarOverlay(false);
this.webview.setHorizontalScrollBarEnabled(false);
this.webview.setHorizontalScrollbarOverlay(false);
this.webview.loadUrl(UrlUtils.handleUrl(BooheeClient.build(BooheeClient.ONE)
.getDefaultURL(String.format(URL_GOODS, new Object[]{Integer.valueOf(this.mGoods
.id)}))));
this.webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (TextUtils.isEmpty(url) || GoodsHomeFragment.this.mGoods == null) {
return false;
}
if (url.contains("boohee://channel_posts")) {
GoodsHomeFragment.this.onGoodsPageChangeListener.onGoodsPageChange(GoodsTab
.POST.getPosition());
} else {
BooheeScheme.handleUrl(GoodsHomeFragment.this.getActivity(), url);
}
return true;
}
});
}
示例3: initWebView
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled"})
private void initWebView() {
this.webview.getSettings().setJavaScriptEnabled(true);
this.webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
this.webview.setVerticalScrollBarEnabled(false);
this.webview.setVerticalScrollbarOverlay(false);
this.webview.setHorizontalScrollBarEnabled(false);
this.webview.setHorizontalScrollbarOverlay(false);
this.webview.loadUrl(UrlUtils.handleUrl(BooheeClient.build(BooheeClient.ONE)
.getDefaultURL(NICE_URL)));
this.webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (TextUtils.isEmpty(url)) {
return false;
}
BooheeScheme.handleUrl(NiceIntroduceFragment.this.getActivity(), url);
return true;
}
});
}
示例4: formatWebView
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static WebView formatWebView(WebView web, boolean isFitScreen) {
// web.setWebChromeClient(new WebChromeClient());
web.setBackgroundColor(Color.parseColor("#00000000"));
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
web.getSettings().setSupportMultipleWindows(false);
web.getSettings().setSupportZoom(true);
web.setVerticalScrollBarEnabled(false);
web.setHorizontalScrollBarEnabled(true);
web.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");
if (isFitScreen) {
web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
}
return web;
}
示例5: formatWebViewWithClient
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
public static WebView formatWebViewWithClient(WebView web,
boolean isFitScreen, boolean enableCLient) {
// web.setWebChromeClient(new WebChromeClient());
web.setBackgroundColor(Color.parseColor("#00000000"));
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
web.getSettings().setSupportMultipleWindows(false);
web.getSettings().setSupportZoom(true);
web.setVerticalScrollBarEnabled(false);
web.setHorizontalScrollBarEnabled(true);
web.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16H) AppleWebKit/537.36(KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");
if (isFitScreen) {
web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
}
if (enableCLient) {
web.setWebViewClient(new MyWebViewClient(true));
}
return web;
}
示例6: onCreate
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setAbContentView(R.layout.activity_broadcast_detail);
msg = (BroadcastMessage) getIntent().getSerializableExtra(
"broadcastMessage");
WebView webView = (WebView) findViewById(R.id.webView);
webView.setBackgroundColor(0x00000000); // 透明背景
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
if (msg != null) {
((TextView) findViewById(R.id.msg_name)).setText(msg.getMsg_name());
((TextView) findViewById(R.id.msg_time)).setText(AbDateUtil
.formatDateStr2Desc(AbDateUtil.getStringByFormat(
msg.getSendTime(), AbDateUtil.dateFormatYMDHMS),
AbDateUtil.dateFormatYMDHMS));
webView.loadDataWithBaseURL(null, msg.getMsg_content(), "text/html",
"utf-8", null);
}
}
示例7: initWebView
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private void initWebView() {
webView = (WebView)findViewById(R.id.wb_details);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
if (!TextUtils.isEmpty(news_url)) {
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);//设置可以运行JS脚本
// settings.setTextZoom(120);//Sets the text zoom of the page in percent. The default is 100.
settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
// settings.setUseWideViewPort(true); //打开页面时, 自适应屏幕
// settings.setLoadWithOverviewMode(true);//打开页面时, 自适应屏幕
settings.setSupportZoom(false);// 用于设置webview放大
settings.setBuiltInZoomControls(false);
webView.setBackgroundResource(R.color.transparent);
// 添加js交互接口类,并起别名 imagelistner
webView.addJavascriptInterface(new JavascriptInterface(getApplicationContext()),"imagelistner");
webView.setWebChromeClient(new MyWebChromeClient());
webView.setWebViewClient(new MyWebViewClient());
new MyAsnycTask().execute(news_url, news_title, news_source + " " +news_date);
}
}
示例8: initUI
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private void initUI() {
viewHolder = new ViewHolder();
viewHolder.txTitle = (TextView) findViewById(R.id.tx_title);
viewHolder.txAuthor = (TextView) findViewById(R.id.tx_author);
viewHolder.txCreateTime = (TextView) findViewById(R.id.tx_create_time);
viewHolder.wvContent = (WebView) findViewById(R.id.wv_wap_content);
WebSettings settings = viewHolder.wvContent.getSettings();
settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
viewHolder.btnBack = (Button) findViewById(R.id.btn_back);
viewHolder.btnBack.setOnClickListener(this);
viewHolder.btnShare = (Button) findViewById(R.id.btn_share);
viewHolder.btnShare.setOnClickListener(this);
viewHolder.btnFavorite = (Button) findViewById(R.id.btn_favorite);
viewHolder.btnFavorite.setOnClickListener(this);
}
示例9: getIndexContent
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private void getIndexContent(String id_) {
HttpUtils.getPostResult(appURLFinal.CONTENT_URL,
appURLFinal.getCONTENT(id_), new getResultCallback() {
@Override
public void getMessage(String message) {
// TODO Auto-generated method stub
condatalist = JSON_Parser.parseJSONContent(message);
System.out.println(condatalist.getContentData()
.getTitle());
tv_contenttitle.setText(condatalist.getContentData()
.getTitle());
textView_content_create_time.setText(condatalist
.getContentData().getCreate_time());
textView_content_source.setText(condatalist
.getContentData().getSource());
wv_contet.loadDataWithBaseURL(null, condatalist
.getContentData().getWap_content(),
"text/html", "utf-8", null);
// ���ò��ֹ�����,ʹ�ؼ�����Ӧ�ֻ���Ļ,ʹ�������ݵȿ���ʾ,���Խ��ͼƬ��������,�����п�����ҳ��������ʧЧ.
wv_contet.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
pd_content.dismiss();
}
});
}
示例10: getBodyContent
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private void getBodyContent(String id_) {
HttpUtils.getPostResult(appURLFinal.CONTENT_URL,
appURLFinal.getCONTENT(id_), new getResultCallback() {
@Override
public void getMessage(String message) {
// TODO Auto-generated method stub
condatalist = JSON_Parser.parseJSONContent(message);
System.out.println(condatalist.getContentData()
.getTitle());
tv_contenttitle.setText(condatalist.getContentData()
.getTitle());
textView_content_create_time.setText(condatalist
.getContentData().getCreate_time());
textView_content_source.setText(condatalist
.getContentData().getSource());
wv_contet.loadDataWithBaseURL(null, condatalist
.getContentData().getWap_content(),
"text/html", "utf-8", null);
// ���ò��ֹ�����,ʹ�ؼ�����Ӧ�ֻ���Ļ,ʹ�������ݵȿ���ʾ,���Խ��ͼƬ��������,�����п�����ҳ��������ʧЧ.
wv_contet.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
pd_content.dismiss();
}
});
}
示例11: createHTMLVideoPlayer
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private View createHTMLVideoPlayer(String url, JSONObject obj, JSONObject stream) {
WebView wv = new WebView(getActivity());
wv.setHorizontalScrollBarEnabled(false);
wv.setWebChromeClient(new BrowserChrome(getMainActivity()));
wv.getSettings().setLoadWithOverviewMode(true);
wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
wv.getSettings().setJavaScriptEnabled(true);
Integer width = null;
if(stream != null && stream.has("width"))
width = stream.optInt("width");
String html = Utils.formatHtmlFragment(obj.optString("embedCode", ""), width);
Log.d(TAG, "HTML is " + html);
wv.loadDataWithBaseURL(url, html, "text/html", "utf-8", null);
m_webViews.add(wv);
return wv;
}
示例12: onPostExecute
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
@Override
protected void onPostExecute(Boolean result) {
isDocBuilding.set(false);
if(isFinishing()) return;
setSupportProgressBarIndeterminateVisibility(false);
if (result) {
if(cacheFile.exists()){
mWeb.loadUrl(Uri.fromFile(cacheFile).toString());
}else
mWeb.loadDataWithBaseURL(getBaseUrl(), mDoc.html(), "text/html", "UTF-8",
null);
if (hasUseMap)
mWeb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
else
mWeb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
try {
mWeb.getSettings().setLayoutAlgorithm(LayoutAlgorithm.TEXT_AUTOSIZING);
} catch (IllegalArgumentException ignored) {
}
}
}
}
示例13: onCreate
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_seementory);
getActionBar().setHomeButtonEnabled(true);
getActionBar().setIcon(R.drawable.general_actionbar_back_btnset);
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.general_actionbar_bg));
webView = (WebView)findViewById(R.id.mentory_web);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
String content = getIntent().getStringExtra("mentoring_text");
String subject = getIntent().getStringExtra("mentoring_subject");
Log.d("SeeMentory", content);
setTitle(subject);
webView.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
//webView.loadUrl(getIntent().getStringExtra("mentoring_srl"));
webView.setWebViewClient(new WebViewClientClass());
this.localyticsSession = new LocalyticsSession(this.getApplicationContext()); // Context used to access device resources
this.localyticsSession.open(); // open the session
this.localyticsSession.upload(); // upload any data
}
示例14: onCreate
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doctypeerror);
webView = (WebView)findViewById(R.id.error_view);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
String error = getIntent().getStringExtra("error");
String uri = getIntent().getStringExtra("uri");
String params = getIntent().getStringExtra("params");
webView.loadDataWithBaseURL(null, error, "text/html", "utf-8", null);
webView.setWebViewClient(new WebViewClientClass());
TextView textView = (TextView)findViewById(R.id.error_text);
textView.setText("uri:"+uri+"\n"+"params:"+params+"\n�� ��ư�� ������ ȭ������ ���ư��ϴ�.");
this.localyticsSession = new LocalyticsSession(this.getApplicationContext()); // Context used to access device resources
this.localyticsSession.open(); // open the session
this.localyticsSession.upload(); // upload any data
}
示例15: initView
import android.webkit.WebSettings.LayoutAlgorithm; //导入依赖的package包/类
private void initView() {
this.mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
this.webView = (WebView) findViewById(R.id.wv_content);
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
this.webView.getSettings().setPluginState(PluginState.ON);
this.webView.getSettings().setUserAgentString(this.webView.getSettings()
.getUserAgentString() + " App/boohee");
this.webView.getSettings().setDomStorageEnabled(true);
this.webView.addJavascriptInterface(new JSInterface(), "jsObj");
this.webView.setWebViewClient(createChromeClient());
this.webView.setWebChromeClient(new MyWebClient());
}