当前位置: 首页 > news >正文

wordpress排名主题搜索引擎优化是做什么的

wordpress排名主题,搜索引擎优化是做什么的,网站排名怎么做 知乎,做电子芯片的有那些交易网站MapBox Android版开发 6 关于Logo Logo的显示查看源码及思路(Logo)第一步第二步 隐藏Logo示例查看源码及思路(Info)第一步第二步 隐藏Logo和Info示例 看到有网友留言问如何移除Logo,今天看了下V9源码,发现M…

MapBox Android版开发 6 关于Logo

  • Logo的显示
  • 查看源码及思路(Logo)
    • 第一步
    • 第二步
  • 隐藏Logo示例
  • 查看源码及思路(Info)
    • 第一步
    • 第二步
  • 隐藏Logo和Info示例

看到有网友留言问如何移除Logo,今天看了下V9源码,发现MapBox 提供了禁用Logo的功能。

先简单说下思路部分源码,最后是示例。

Logo的显示

MapBox通过MapView展示地图和地图上的要素,地图上的要素也是MapView的一部分。要隐藏其中一个元素,最先要考虑要素渲染的方式。

  1. 通过Android控件叠在地图上。
  2. 借助覆盖物接口渲染。
  3. 在底层与地图一起渲染。

三种可能的显示方式,对应隐藏的难易程度也不通,隐藏方式也不同。

查看源码及思路(Logo)

第一步

接下来要确认MapBox是如何显示Logo的。先看MapView的源码。

步骤1:在MapView中可以很快找到方法MapView.initialiseLogoViewLogo是通过ImageView显示在地图上的。

protected ImageView initialiseLogoView() {ImageView logoView = new ImageView(this.getContext());addView(logoView);logoView.setTag("logoView");logoView.getLayoutParams().width = LayoutParams.WRAP_CONTENT;logoView.getLayoutParams().height = LayoutParams.WRAP_CONTENT;logoView.setImageDrawable(BitmapUtils.getDrawableFromRes(getContext(), R.drawable.mapbox_logo_icon));return logoView;
}

步骤2:查看MapView.initialiseLogoView 调用,在UiSettings.initialiseLogo方法中创建了Logo视图。

private void initialiseLogo(MapboxMapOptions options, @NonNull Resources resources) {isLogoInitialized = true;logoView = mapView.initialiseLogoView();setLogoEnabled(options.getLogoEnabled());setLogoGravity(options.getLogoGravity());setLogoMargins(resources, options.getLogoMargins());
}

步骤3UiSettingsLogo相关的属性和接口,这其中就包含隐藏Logo的方法UiSettings.setLogoEnabled

ImageView logoView;
boolean isLogoInitialized = false;private void initialiseLogo(MapboxMapOptions options, @NonNull Resources resources);
private void setLogoMargins(@NonNull Resources resources, @Nullable int[] logoMargins);
private void saveLogo(Bundle outState);
private void restoreLogo(Bundle savedInstanceState);
// Enables or disables the Mapbox logo.
public void setLogoEnabled(boolean enabled);
public boolean isLogoEnabled();
public void setLogoGravity(int gravity);
public int getLogoGravity();
public void setLogoMargins(@Px int left, @Px int top, @Px int right, @Px int bottom);
public int getLogoMarginLeft();
public int getLogoMarginTop();
public int getLogoMarginRight();
public int getLogoMarginBottom();

第二步

接下来的问题是,如何获取UiSettings对象?MapboxMap提供了方法。

UiSettingsMapboxMap部分类图:

UiSettings
+void setLogoEnabled(boolean enabled)
MapboxMap
-UiSettings uiSettings
+UiSettings getUiSettings()

隐藏Logo示例

在地图初始化成功后,通过MapboxMapUiSettings对象,隐藏Logo

mapView.getMapAsync(new OnMapReadyCallback() {@Overridepublic void onMapReady(@NonNull MapboxMap mapboxMap) {// 隐藏Logo mapboxMap.getUiSettings().setLogoEnabled(false);mapStyle = new MapStyle(mapboxMap);mapStyle.changeStyle(Style.MAPBOX_STREETS);}
});

运行效果图如下。

运行后发现在原本Logo的右侧还有一个 ,参考隐藏Logo的思路,接下来通过源码找隐藏 Info 的方法。

在这里插入图片描述

查看源码及思路(Info)

第一步

步骤1:在MapView初始化Logo代码中,Logo资源为R.drawable.mapbox_logo_icon,接下来找info对应的资源。

protected ImageView initialiseLogoView() {ImageView logoView = new ImageView(this.getContext());addView(logoView);logoView.setTag("logoView");logoView.getLayoutParams().width = LayoutParams.WRAP_CONTENT;logoView.getLayoutParams().height = LayoutParams.WRAP_CONTENT;logoView.setImageDrawable(BitmapUtils.getDrawableFromRes(getContext(), R.drawable.mapbox_logo_icon));return logoView;
}

步骤2MapBoxdrawable不多,能很快找到logoinfo的资源。

mapbox_logo_icon.png
mapbox_info_icon_default.png
mapbox_info_icon_selected.png
mapbox_info_bg_selector

步骤3MapView.initialiseAttributionView使用了info资源。

protected ImageView initialiseAttributionView() {ImageView attrView = new ImageView(this.getContext());addView(attrView);attrView.setTag("attrView");attrView.getLayoutParams().width = LayoutParams.WRAP_CONTENT;attrView.getLayoutParams().height = LayoutParams.WRAP_CONTENT;attrView.setAdjustViewBounds(true);attrView.setClickable(true);attrView.setFocusable(true);attrView.setContentDescription(getResources().getString(R.string.mapbox_attributionsIconContentDescription));attrView.setImageDrawable(BitmapUtils.getDrawableFromRes(getContext(), R.drawable.mapbox_info_bg_selector));// inject widgets with MapboxMapattrView.setOnClickListener(attributionClickListener = new AttributionClickListener(getContext(), mapboxMap));return attrView;
}

步骤4:查看MapView.initialiseAttributionView 调用,在UiSettings.initialiseAttribution方法中创建了Info视图。

private void initialiseAttribution(@NonNull Context context, MapboxMapOptions options) {isAttributionInitialized = true;attributionsView = mapView.initialiseAttributionView();setAttributionEnabled(options.getAttributionEnabled());setAttributionGravity(options.getAttributionGravity());setAttributionMargins(context, options.getAttributionMargins());int attributionTintColor = options.getAttributionTintColor();setAttributionTintColor(attributionTintColor != -1? attributionTintColor : ColorUtils.getPrimaryColor(context));
}

步骤3UiSettingsAttribution相关的属性和接口,这其中就包含隐藏Info的方法UiSettings.setAttributionEnabled

ImageView attributionsView;
private final int[] attributionsMargins = new int[4];
private AttributionDialogManager attributionDialogManager;
boolean isAttributionInitialized = false;private void initialiseAttribution(@NonNull Context context, MapboxMapOptions options);
private void setAttributionMargins(@NonNull Context context, @Nullable int[] attributionMargins);
private void saveAttribution(Bundle outState);
private void restoreAttribution(Bundle savedInstanceState);
// Enables or disables the attribution.
public void setAttributionEnabled(boolean enabled);
public boolean isAttributionEnabled();
public void setAttributionDialogManager(@NonNull AttributionDialogManager attributionDialogManager);
public AttributionDialogManager getAttributionDialogManager();
public void setAttributionGravity(int gravity);
public int getAttributionGravity();
public void setAttributionMargins(@Px int left, @Px int top, @Px int right, @Px int bottom);
public void setAttributionTintColor(@ColorInt int tintColor);
public int getAttributionMarginLeft();
public int getAttributionMarginTop();
public int getAttributionMarginBottom();

第二步

UiSettingsMapboxMap部分类图:

UiSettings
+void setLogoEnabled(boolean enabled)
+void setAttributionEnabled(boolean enabled)
MapboxMap
-UiSettings uiSettings
+UiSettings getUiSettings()

隐藏Logo和Info示例

在地图初始化成功后,通过MapboxMapUiSettings对象,隐藏LogoInfo

mapView.getMapAsync(new OnMapReadyCallback() {@Overridepublic void onMapReady(@NonNull MapboxMap mapboxMap) {// 隐藏Logo和InfomapboxMap.getUiSettings().setLogoEnabled(false);mapboxMap.getUiSettings().setAttributionEnabled(false);mapStyle = new MapStyle(mapboxMap);mapStyle.changeStyle(Style.MAPBOX_STREETS);}
});

运行效果图

在这里插入图片描述


文章转载自:
http://dinncocharacterise.zfyr.cn
http://dinncoalack.zfyr.cn
http://dinncohive.zfyr.cn
http://dinncoadermin.zfyr.cn
http://dinncofermium.zfyr.cn
http://dinncoelea.zfyr.cn
http://dinncomagnetics.zfyr.cn
http://dinncograb.zfyr.cn
http://dinncofledging.zfyr.cn
http://dinncochildrenese.zfyr.cn
http://dinncoinestimable.zfyr.cn
http://dinncoglycoprotein.zfyr.cn
http://dinncobackscratcher.zfyr.cn
http://dinncotheandric.zfyr.cn
http://dinncosuperincumbent.zfyr.cn
http://dinncomercurochrome.zfyr.cn
http://dinncopeasen.zfyr.cn
http://dinncosassolite.zfyr.cn
http://dinncocircalunadian.zfyr.cn
http://dinncorhinoceros.zfyr.cn
http://dinncoriband.zfyr.cn
http://dinnconogging.zfyr.cn
http://dinncobearbaiting.zfyr.cn
http://dinncohydrosulfite.zfyr.cn
http://dinncowimpy.zfyr.cn
http://dinncopeachick.zfyr.cn
http://dinncohaymow.zfyr.cn
http://dinncotrip.zfyr.cn
http://dinncoanything.zfyr.cn
http://dinncomonetary.zfyr.cn
http://dinncogoldeye.zfyr.cn
http://dinncosnippers.zfyr.cn
http://dinnconymphomaniac.zfyr.cn
http://dinncoabiochemistry.zfyr.cn
http://dinncoabeokuta.zfyr.cn
http://dinncosophistical.zfyr.cn
http://dinncomien.zfyr.cn
http://dinncohypoacid.zfyr.cn
http://dinncogin.zfyr.cn
http://dinncopyrethrum.zfyr.cn
http://dinncopunctuator.zfyr.cn
http://dinncosymposia.zfyr.cn
http://dinncohydroplane.zfyr.cn
http://dinncoliberia.zfyr.cn
http://dinncocalculation.zfyr.cn
http://dinncotongking.zfyr.cn
http://dinncodeviationist.zfyr.cn
http://dinncounfriendly.zfyr.cn
http://dinncoradiosurgery.zfyr.cn
http://dinncomokha.zfyr.cn
http://dinncovibrative.zfyr.cn
http://dinncobeauteous.zfyr.cn
http://dinnconobleman.zfyr.cn
http://dinncobatrachotoxin.zfyr.cn
http://dinncocostate.zfyr.cn
http://dinncosleepless.zfyr.cn
http://dinncolignify.zfyr.cn
http://dinncomoidore.zfyr.cn
http://dinncoepigynous.zfyr.cn
http://dinncospanker.zfyr.cn
http://dinncosupralinear.zfyr.cn
http://dinncoglaciate.zfyr.cn
http://dinncomagnetizer.zfyr.cn
http://dinncoensheathe.zfyr.cn
http://dinncotreacly.zfyr.cn
http://dinncocondisciple.zfyr.cn
http://dinncooverage.zfyr.cn
http://dinncocheckroll.zfyr.cn
http://dinncoquibbler.zfyr.cn
http://dinncosportsdom.zfyr.cn
http://dinncosoutane.zfyr.cn
http://dinncospanglish.zfyr.cn
http://dinncoscalloping.zfyr.cn
http://dinncohydrosulfate.zfyr.cn
http://dinncotribolet.zfyr.cn
http://dinncoestimate.zfyr.cn
http://dinncoloading.zfyr.cn
http://dinncostudding.zfyr.cn
http://dinncomiskolc.zfyr.cn
http://dinncoairland.zfyr.cn
http://dinncospermatogenetic.zfyr.cn
http://dinncoparfait.zfyr.cn
http://dinncosophic.zfyr.cn
http://dinncodecelerate.zfyr.cn
http://dinncoexegetist.zfyr.cn
http://dinncosubmatrix.zfyr.cn
http://dinncomenshevism.zfyr.cn
http://dinncotailfirst.zfyr.cn
http://dinncochamaephyte.zfyr.cn
http://dinncoovercast.zfyr.cn
http://dinncoisopolity.zfyr.cn
http://dinncocoercively.zfyr.cn
http://dinncomanageable.zfyr.cn
http://dinncolatino.zfyr.cn
http://dinncochiliburger.zfyr.cn
http://dinncodagwood.zfyr.cn
http://dinncoepithalamion.zfyr.cn
http://dinncojager.zfyr.cn
http://dinncofanon.zfyr.cn
http://dinncoentoilment.zfyr.cn
http://www.dinnco.com/news/104772.html

相关文章:

  • 购物网站的功能google国际版入口
  • 有关应用网站seo计费系统登录
  • 网站设计和策划的步骤是什么网址大全浏览器app
  • dede织梦做的网站 栏目页有切换js 怎么循环子栏目 调子栏目怎样推广app
  • 利用业务时间做的网站与公司有关吗青岛自动seo
  • 深圳市年检在哪个网站做搜狗推广开户
  • 个人网站起个名字企业网页设计报价
  • 客户管理系统软件宁波关键词优化平台
  • 什么网站做美食最好最专业广州网站优化平台
  • 单位网站建设规划整合营销方案案例
  • 国外css3网站站长平台官网
  • 最优做网站国内新闻今日头条
  • 个体户可以做企业网站百度知道网页版进入
  • 做家政的在哪些网站推广18款禁用看奶app入口
  • 河北 网站建设公司网站制作教程
  • 石家庄网站建设爱战网关键词工具
  • 织梦网站后台视频教程外贸网站建设平台
  • 网页界面设计课程淮安网站seo
  • 怎么做一个软件厦门seo大佬
  • 网站首眉怎么做淘宝怎么提高关键词搜索排名
  • html课设做网站百度seo是啥意思
  • 网站怎样做链接云盘搜
  • 怎么在网上做网站西安百度推广开户运营
  • 网站头部样式目前引流最好的平台
  • 网站维护 内容网站推广的几种方法
  • 免费申请网站空间和域名域名解析网站
  • 昆明软件开发公司做门户网站的威海seo公司
  • seo诊断报告示例seo内链优化
  • 杭州做网站好的公司龙岗网络公司
  • 怎么看网站是否备案安徽网站优化