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


Java IconGenerator.setContentView方法代码示例

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


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

示例1: addIcon

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
private void addIcon(IconGenerator iconFactory, String text, LatLng position) {
  TextView mmTextMapView = new TextView(this);
  mmTextMapView.setTypeface(font);
  ViewGroup.LayoutParams layoutParams =
      new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
          ViewGroup.LayoutParams.WRAP_CONTENT);
  mmTextMapView.setLayoutParams(layoutParams);
  mmTextMapView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
  mmTextMapView.setTextColor(getResources().getColor(R.color.text_color));
  mmTextMapView.setText(text);
  iconFactory.setContentView(mmTextMapView);

  MarkerOptions markerOptions = new MarkerOptions().
      icon(BitmapDescriptorFactory.fromBitmap(
          iconFactory.makeIcon(mmTextMapView.getText().toString()))).
      position(position).
      anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());
  map.getMap().addMarker(markerOptions);
}
 
开发者ID:MMAUG,项目名称:BF101,代码行数:20,代码来源:DetailActivity.java

示例2: NodeClusterRenderer

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
public NodeClusterRenderer(Context context, GoogleMap map, NodeClusterManager<T> clusterManager) {
    mMap = map;
    mDensity = context.getResources().getDisplayMetrics().density;
    mIconGenerator = new IconGenerator(context);
    mIconGenerator.setContentView(makeSquareTextView(context));
    mIconGenerator.setTextAppearance(com.google.maps.android.R.style.ClusterIcon_TextAppearance);
    mIconGenerator.setBackground(makeClusterBackground());
    mClusterManager = clusterManager;
    shouldAnimate = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}
 
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:11,代码来源:NodeClusterRenderer.java

示例3: DefaultClusterRenderer

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
public DefaultClusterRenderer(Context context, GoogleMap map, ClusterManager<T> clusterManager) {
    mMap = map;
    mDensity = context.getResources().getDisplayMetrics().density;
    mIconGenerator = new IconGenerator(context);
    mIconGenerator.setContentView(makeSquareTextView(context));
    mIconGenerator.setTextAppearance(R.style.ClusterIcon_TextAppearance);
    mIconGenerator.setBackground(makeClusterBackground());
    mClusterManager = clusterManager;
}
 
开发者ID:dklisiaris,项目名称:downtown,代码行数:10,代码来源:DefaultClusterRenderer.java

示例4: drawMarkers

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
private void drawMarkers(ArrayList<Event> events) {
    map.clear();
    for (int i = 0; i < events.size(); i++) {
        Event currentEvent = events.get(i);
        LatLng latLng = new LatLng(currentEvent.getCoordinates().getLatitude(), events.get(i).getCoordinates().getLongitude());
        String category = currentEvent.getCategory();
        String snippet = currentEvent.getMessage();
        IconGenerator iconGenerator = new IconGenerator(this);
        if (currentUser.getHash().compareTo(currentEvent.getAuthorHash()) == 0) {
            iconGenerator.setStyle(IconGenerator.STYLE_GREEN);
        }
        else if (currentEvent.getRespondentsHash().indexOf(currentUser.getHash()) != -1) {
            iconGenerator.setStyle(IconGenerator.STYLE_ORANGE);
        }
        else {
            iconGenerator.setStyle(IconGenerator.STYLE_BLUE);
        }
        ImageView imageView = new ImageView(this);
        Bitmap categoryIcon = DataExchange.categories.get(category);
        Bitmap bmp;
        if (categoryIcon != null) {
            iconGenerator.setContentView(imageView);
            imageView.setImageBitmap(categoryIcon);
            imageView.setPadding(10, 10, 10, 10);
            bmp = iconGenerator.makeIcon();
        }
        else {
            bmp = iconGenerator.makeIcon(category);
        }
        currentEvent.setMarkerId(map.addMarker(new MarkerOptions()
                .position(latLng)
                .title(getString(R.string.attenders_text, currentEvent.getRespondentsHash().size()))
                .snippet(snippet)
                .icon(BitmapDescriptorFactory.fromBitmap(bmp))
            ).getId());
    }
}
 
开发者ID:chechulinYuri,项目名称:stepout,代码行数:38,代码来源:MapsActivity.java

示例5: DefaultClusterRenderer

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
public DefaultClusterRenderer(Context context, GoogleMap map, ClusterManager<T> clusterManager) {
    mMap = map;
    mAnimate = true;
    mDensity = context.getResources().getDisplayMetrics().density;
    mIconGenerator = new IconGenerator(context);
    mIconGenerator.setContentView(makeSquareTextView(context));
    mIconGenerator.setTextAppearance(R.style.amu_ClusterIcon_TextAppearance);
    mIconGenerator.setBackground(makeClusterBackground());
    mClusterManager = clusterManager;
}
 
开发者ID:googlemaps,项目名称:android-maps-utils,代码行数:11,代码来源:DefaultClusterRenderer.java


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