本文整理汇总了Java中android.widget.ZoomButtonsController类的典型用法代码示例。如果您正苦于以下问题:Java ZoomButtonsController类的具体用法?Java ZoomButtonsController怎么用?Java ZoomButtonsController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZoomButtonsController类属于android.widget包,在下文中一共展示了ZoomButtonsController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint({"JavascriptInterface", "SetJavaScriptEnabled"})
public static void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(14);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
//webView.setWebViewClient(UiUtil.getWebViewClient());
}
示例2: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled"})
public static void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(15);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 19) {
webView.getSettings().setLoadsImagesAutomatically(true);
} else {
webView.getSettings().setLoadsImagesAutomatically(false);
}
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
addWebImageShow(webView.getContext(), webView);
}
示例3: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled", "JavascriptInterface"})
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(15);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
}
示例4: setupZoomButtonController
import android.widget.ZoomButtonsController; //导入依赖的package包/类
private void setupZoomButtonController(final View ownerView) {
mZoomButtonsController = new ZoomButtonsController(ownerView);
mZoomButtonsController.setAutoDismissed(false);
mZoomButtonsController.setZoomSpeed(100);
mZoomButtonsController.setOnZoomListener(
new ZoomButtonsController.OnZoomListener() {
public void onVisibilityChanged(boolean visible) {
if (visible) {
updateZoomButtonsEnabled();
}
}
public void onZoom(boolean zoomIn) {
if (zoomIn) {
mImageView.zoomIn();
} else {
mImageView.zoomOut();
}
mZoomButtonsController.setVisible(true);
updateZoomButtonsEnabled();
}
});
}
示例5: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" })
public static void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(15);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
webView.setWebViewClient(UIHelper.getWebViewClient());
}
示例6: init
import android.widget.ZoomButtonsController; //导入依赖的package包/类
/**
* Initializes the view
*
* @param context
* {@link Context}
*/
private void init(Context context) {
setFocusable(true);
scroller = new Scroller(context);
gestureDetector = new GestureDetector(context, this);
scaleGestureDetector = new ScaleGestureDetector(context, this);
zoomController = new ZoomButtonsController(this);
zoomController.setOnZoomListener(this);
matrix = new Matrix();
destination = new float[2];
// setVerticalScrollBarEnabled(true);
// setHorizontalScrollBarEnabled(true);
}
示例7: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(20);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
UIHelper.addWebImageShow(getActivity(), webView);
}
示例8: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint({"SetJavaScriptEnabled", "JavascriptInterface"})
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(15);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
UIHelper.addWebImageShow(getActivity(), webView);
}
示例9: setupZoomButtonController
import android.widget.ZoomButtonsController; //导入依赖的package包/类
private void setupZoomButtonController(final View ownerView) {
mZoomButtonsController = new ZoomButtonsController(ownerView);
mZoomButtonsController.setAutoDismissed(false);
mZoomButtonsController.setZoomSpeed(100);
mZoomButtonsController
.setOnZoomListener(new ZoomButtonsController.OnZoomListener() {
public void onVisibilityChanged(boolean visible) {
if (visible) {
updateZoomButtonsEnabled();
}
}
public void onZoom(boolean zoomIn) {
if (zoomIn) {
mImageView.zoomIn();
} else {
mImageView.zoomOut();
}
mZoomButtonsController.setVisible(true);
updateZoomButtonsEnabled();
}
});
}
示例10: onTouchEvent
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
if (m_RocrailService.Prefs.Zoom && levelView.zoomButtonsController == null) {
levelView.zoomButtonsController = new ZoomButtonsController(getWindow().getDecorView());
levelView.zoomButtonsController.setOnZoomListener(this);
levelView.zoomButtonsController.setZoomInEnabled(m_RocrailService.Prefs.Size < 64 );
levelView.zoomButtonsController.setZoomOutEnabled(m_RocrailService.Prefs.Size > 8 );
}
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
System.out.println("uptime="+SystemClock.uptimeMillis()+" downtime="+event.getDownTime());
if (m_RocrailService.Prefs.Zoom && (SystemClock.uptimeMillis() - event.getDownTime()) > 1000 && levelView.zoomButtonsController != null) {
levelView.zoomButtonsController.setVisible(true);
levelView.zoomButtonsController.setFocusable(true);
levelView.zoomButtonsController.getZoomControls().setFocusable(true);
levelView.zoomButtonsController.getZoomControls().setFocusableInTouchMode(true);
levelView.zoomButtonsController.getZoomControls().requestFocus();
return true;
}
}
return levelView.onTouchEvent(event);
}
示例11: setDisplayZoomControl
import android.widget.ZoomButtonsController; //导入依赖的package包/类
/**
* Set option to display zoom control
* http://stackoverflow.com/a/11901948
*
* @param show
*/
@SuppressLint("NewApi")
public void setDisplayZoomControl(boolean show) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
this.getSettings().setDisplayZoomControls(show);
} else {
// get the control
try {
Class webview = Class.forName("android.webkit.WebView");
Method method = webview.getMethod("getZoomButtonsController");
zoom_controll = (ZoomButtonsController) method.invoke(this, null);
showZoom = show;
} catch (Exception e) {
Log.e(TAG, "Error when getting zoom control", e);
}
}
}
示例12: initWebView
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@SuppressLint({ "SetJavaScriptEnabled", "JavascriptInterface" })
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void initWebView(WebView webView) {
WebSettings settings = webView.getSettings();
settings.setDefaultFontSize(15);
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
int sysVersion = Build.VERSION.SDK_INT;
if (sysVersion >= 11) {
settings.setDisplayZoomControls(false);
} else {
ZoomButtonsController zbc = new ZoomButtonsController(webView);
zbc.getZoomControls().setVisibility(View.GONE);
}
UIHelper.addWebImageShow(getActivity(), webView);
}
示例13: makeZoomLabel
import android.widget.ZoomButtonsController; //导入依赖的package包/类
/**
* @param context
* @param zoomController
*/
private void makeZoomLabel(Context context, ZoomButtonsController zoomController) {
ViewGroup container = zoomController.getContainer();
View controls = zoomController.getZoomControls();
LayoutParams p0 = controls.getLayoutParams();
container.removeView(controls);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
mZoomLabel = new TextView(context);
mZoomLabel.setPadding(12, 0, 12, 0);
mZoomLabel.setTypeface(Typeface.DEFAULT_BOLD);
mZoomLabel.setTextColor(0xff000000);
PaintDrawable d = new PaintDrawable(0xeeffffff);
d.setCornerRadius(6);
mZoomLabel.setBackgroundDrawable(d);
mZoomLabel.setTextSize(20);
mZoomLabel.setGravity(Gravity.CENTER_HORIZONTAL);
LinearLayout.LayoutParams p1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
p1.gravity = Gravity.CENTER_HORIZONTAL;
layout.addView(mZoomLabel, p1);
layout.addView(controls);
container.addView(layout, p0);
}
示例14: updateZoomControls
import android.widget.ZoomButtonsController; //导入依赖的package包/类
@Override
public void updateZoomControls() {
ZoomButtonsController zoomController = getZoomController();
if (zoomController == null) {
return;
}
boolean canZoomIn = mAwContents.canZoomIn();
boolean canZoomOut = mAwContents.canZoomOut();
if (!canZoomIn && !canZoomOut) {
// Hide the zoom in and out buttons if the page cannot zoom
zoomController.getZoomControls().setVisibility(View.GONE);
} else {
// Set each one individually, as a page may be able to zoom in or out
zoomController.setZoomInEnabled(canZoomIn);
zoomController.setZoomOutEnabled(canZoomOut);
}
}
示例15: init
import android.widget.ZoomButtonsController; //导入依赖的package包/类
/**
* Initializes the view
*
* @param context
* {@link Context}
*/
private void init(Context context) {
setFocusable(true);
scroller = new Scroller(context);
gestureDetector = new GestureDetector(context, this);
scaleGestureDetector = new ScaleGestureDetector(context, this);
zoomController = new ZoomButtonsController(this);
zoomController.setOnZoomListener(this);
matrix = new Matrix();
destination = new float[2];
// setVerticalScrollBarEnabled(true);
// setHorizontalScrollBarEnabled(true);
}