本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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());
}
}
示例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;
}