再怎么添加新增活动界面的activity不显示界面标记

您所在位置: &
&nbsp&&nbsp&nbsp&&nbsp
软件工程专业毕业论文--基于Android系统的五子棋界面设计.doc30页
本文档一共被下载:
次 ,您可免费全文在线阅读后下载本文档
文档加载中...广告还剩秒
需要金币:100 &&
你可能关注的文档:
··········
··········
当今的世界是一个信息极大丰富的世界,所以人们对于各种信息的获取都有着强烈的需求。人们往往会借助报纸、手机、电视、网络等方式来获取和处理各种信息。随着科技的发展,手机作为一种非常重要的通讯工具,其功能越来越强大,相对电视,网络等方式,手机凭借着它的便携性和处理信息的优势,日益成为人们获取信息的一种重要手段。
但是实际上并不是所有的手机都可以满足人们这种相对复杂的功能要求,而智能手机由于强大的功能令其成为所有手机中最好的选择。目前市场上的智能手机有几大类,分别是symbian、windows mobiile、linux、黑莓。不过近两年来上市的Android操作系统由于具有良好的开放性和平台开发的便捷性等特点,使得采用Android的手机愈加受到人们的青睐。在此同时,Android操作系统的手机在智能手机领域所占的比重越来越重。所以,我将Android系统下的五子棋小游戏作为本次毕业设计研究对象。
关键词:A智能手机;五子棋小游戏;操作系统。
Nowadays,there is abundant information in the world,people have a strong demand for the access to different information.We tend to get and process information through newspaper,mobile phone,TV and Internet.With the development of science and technology,as a very important communication tool,the mobile phone has a more and more powerful function.The mobile phone is becoming an important means of
getting information because it has an advantage on portability and information processing when compare to TV,Internet and other means
In fact,not every mobile phone can satisfy people's needs of relatively complicated function,the smartphone is proved to be the best choice as its powerful function.For now,there are several categories of smartphone in the market,they are symbian,windows mobile,linux,blackberry.But the mobile phone using
正在加载中,请稍后...android 里怎么实现一个图层,比如说我现在有个Activity,要在上面加一个标记android&里怎么实现一个图层,比如说我现在有个Activity,要在上面加一个标记。类似与Google&map&OverLay一样。
&不知道大家有什么想法呢?&请大侠指教一下
回答1:onDraw时候自己画
回答2:不是画在activity里,应该有个显示的view,在那个view上画。或者用个新的window,实现方式很多
回答3:楼主在activity中可以使用dialog,或者popwindow都可以达到你要的效果
回答4:简单实现一例:
  public&void&onCreate(Bundle&savedInstanceState)&{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DisplayMetrics&dm&=&new&DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);
width&=&dm.widthP
height&=&dm.heightP
iv&=&(ImageView)&this.findViewById(R.id.iv);
iv.setOnClickListener(new&OnClickListener()&{
public&void&onClick(View&v)&{
int&l&=&rand.nextInt(width);
int&t&=&rand.nextInt(height);
int&ivWidth&=&iv.getMeasuredWidth();
int&ivHeight&=&iv.getMeasuredHeight();
if&(l&$>$width&-&ivWidth)&{
l&=&width&-&ivW
if&(t&$>$height&-&ivHeight&-&50)&{
t&=&height&-&ivHeight&-&50;
Log.v("btn&l,t:",&""&+&l&+&","&+&t);
iv.layout(l,&t,&l&+&ivWidth,&t&+&ivHeight);
  & xml&version="1.0"&encoding="utf-8" &
&RelativeLayout
&&&&xmlns:android=""
&&&&android:orientation="vertical"
&&&&android:layout_width="fill_parent"
&&&&android:layout_height="fill_parent"&
&&&&&TextView
&&&&&&&&android:layout_width="fill_parent"I referred
. i want show info window with image for all markers in android.
解决方案 MyItem Class
import com.google.android.gms.maps.model.LatL
import com.google.maps.android.clustering.ClusterI
public class MyItem implements ClusterItem {
private LatLng mP
private String mLatitude = "";
private String mStoreLogo = "";
private String mLongitude = "";
public LatLng getPosition() {
public void setPosition(LatLng mPosition) {
this.mPosition = mP
public LatLng getmPosition() {
public void setmPosition(LatLng mPosition) {
this.mPosition = mP
public String getmLatitude() {
public void setmLatitude(String mLatitude) {
this.mLatitude = mL
public String getmLongitude() {
public void setmLongitude(String mLongitude) {
this.mLongitude = mL
public String getmStoreLogo() {
return mStoreL
public void setmStoreLogo(String mStoreLogo) {
this.mStoreLogo = mStoreL
YourActivity Class :
public class Map extends FragmentActivity implements
ClusterManager.OnClusterClickListener&MyItem&,
ClusterManager.OnClusterInfoWindowClickListener&MyItem&,
ClusterManager.OnClusterItemClickListener&MyItem&,
ClusterManager.OnClusterItemInfoWindowClickListener&MyItem& {
private ClusterManager&MyItem& mClusterM
private Cluster&MyItem& clickedC
private MyItem clickedClusterI
@SuppressWarnings("unchecked")
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView(R.layout.map_view);
// Initializing Map from XML :
GooglePlayServicesUtil.isGooglePlayServicesAvailable(Map.this);
SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.mMapView);
mMapView = mapFrag.getMap();
mMapView.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMapView.getUiSettings().setZoomControlsEnabled(true);
mMapView.getUiSettings().setCompassEnabled(true);
mMapView.getUiSettings().setMyLocationButtonEnabled(true);
mMapView.getUiSettings().setRotateGesturesEnabled(true);
mMapView.getUiSettings().setScrollGesturesEnabled(true);
mMapView.getUiSettings().setTiltGesturesEnabled(true);
mMapView.getUiSettings().setZoomGesturesEnabled(true);
mMapView.setMyLocationEnabled(true);
} catch (Exception e) {
mMapFrame.setVisibility(View.GONE);
Utils.displayToast("Your device doesn't support Google Map",
Map.this);
// Creating cluster manager object.
mClusterManager = new ClusterManager&MyItem&(Map.this, mMapView);
mMapView.setOnCameraChangeListener(mClusterManager);
mClusterManager.setRenderer(new MyClusterRenderer(Map.this, mMapView,
mClusterManager));
mMapView.setOnInfoWindowClickListener(mClusterManager);
mMapView.setInfoWindowAdapter(mClusterManager.getMarkerManager());
mClusterManager.getClusterMarkerCollection().setOnInfoWindowAdapter(
new MyCustomAdapterForClusters());
mClusterManager.getMarkerCollection().setOnInfoWindowAdapter(
new MyCustomAdapterForItems());
mMapView.setOnMarkerClickListener(mClusterManager);
mClusterManager.setOnClusterClickListener(this);
mClusterManager.setOnClusterInfoWindowClickListener(this);
mClusterManager.setOnClusterItemClickListener(this);
mClusterManager.setOnClusterItemInfoWindowClickListener(this);
mClusterManager
.setOnClusterClickListener(new OnClusterClickListener&MyItem&() {
public boolean onClusterClick(Cluster&MyItem& cluster) {
clickedCluster =
mClusterManager
.setOnClusterItemClickListener(new OnClusterItemClickListener&MyItem&() {
public boolean onClusterItemClick(MyItem item) {
clickedClusterItem =
Adding Objects to the Cluster.
mClusterManager.addItem(mItemData);
mMapView.animateCamera(CameraUpdateFactory
.newLatLngZoom(mLatLng, 7));
mClusterManager.cluster();
class MyClusterRenderer extends DefaultClusterRenderer&MyItem& {
public MyClusterRenderer(Context context, GoogleMap map,
ClusterManager&MyItem& clusterManager) {
super(context, map, clusterManager);
protected void onBeforeClusterItemRendered(MyItem item,
MarkerOptions markerOptions) {
super.onBeforeClusterItemRendered(item, markerOptions);
protected void onClusterItemRendered(MyItem clusterItem, Marker marker) {
super.onClusterItemRendered(clusterItem, marker);
// Custom adapter info view :
public class MyCustomAdapterForItems implements InfoWindowAdapter {
private final View myContentsV
MyCustomAdapterForItems() {
myContentsView = getLayoutInflater().inflate(
R.layout.map_info_window_dialog, null);
public View getInfoContents(Marker marker) {
public View getInfoWindow(Marker marker) {
// TODO Auto-generated method stub
TextView tvTitle = ((TextView) myContentsView
.findViewById(R.id.txtHeader));
TextView tvSnippet = ((TextView) myContentsView
.findViewById(R.id.txtAddress));
tvTitle.setTypeface(mTyFaceKreonBold);
tvSnippet.setTypeface(mTyFaceKreonBold);
if (clickedClusterItem != null) {
tvTitle.setText(clickedClusterItem.getmStoreName());
tvSnippet.setText(clickedClusterItem.getmAddressOne());
return myContentsV
// class for Main Clusters.
public class MyCustomAdapterForClusters implements InfoWindowAdapter {
private final View myContentsV
MyCustomAdapterForClusters() {
myContentsView = getLayoutInflater().inflate(
R.layout.map_info_window_dialog, null);
public View getInfoContents(Marker marker) {
public View getInfoWindow(Marker marker) {
// TODO Auto-generated method stub
TextView tvTitle = ((TextView) myContentsView
.findViewById(R.id.txtHeader));
TextView tvSnippet = ((TextView) myContentsView
.findViewById(R.id.txtAddress));
tvSnippet.setVisibility(View.GONE);
tvTitle.setTypeface(mTyFaceKreonBold);
tvSnippet.setTypeface(mTyFaceKreonBold);
if (clickedCluster != null) {
tvTitle.setText(String
.valueOf(clickedCluster.getItems().size())
+ " more offers available");
return myContentsV
public void onClusterItemInfoWindowClick(MyItem item) {
// TODO Auto-generated method stub
Intent intent = new Intent(Map.this,NextActivity.class);
intent.putExtra("mLatitude", item.getmLatitude());
intent.putExtra("mLongitude", item.getmLongitude());
startActivity(intent);
public boolean onClusterItemClick(MyItem item) {
// TODO Auto-generated method stub
public void onClusterInfoWindowClick(Cluster&MyItem& cluster) {
// TODO Auto-generated method stub
public boolean onClusterClick(Cluster&MyItem& cluster) {
// TODO Auto-generated method stub
The code is self explanatory. Hooe you had added the cluster library and google play services lib to your build path. Please let me know if you have any queries.
本文地址: &
扫一扫关注官方微信【Android开发基础】应用界面主题Theme使用方法 -开发技巧-ab蓝学网
【Android开发基础】应用界面主题Theme使用方法
简介:android|主题Theme就是用来设置界面UI风格,可以设置整个应用或者某个活动Activity的界面风格。在AndroidSDK中内置了下面的Theme,可以按标题栏TitleBar和状态栏StatusBar是...
主题Theme就是用来设置界面UI风格,可以设置整个应用或者某个活动Activity的界面风格。在Android SDK中内置了下面的Theme,可以按标题栏Title Bar和状态栏Status Bar是否可见来分类:
oandroid:theme=&@android:style/Theme.Dialog&&&&将一个Activity显示为能话框模式&&
oandroid:theme=&@android:style/Theme.NoTitleBar&&&不显示应用程序标题栏&&
oandroid:theme=&@android:style/Theme.NoTitleBar.Fullscreen&&&不显示应用程序标题栏,并全屏&&
oandroid:theme=&Theme.Light&&&背景为白色&&
oandroid:theme=&Theme.Light.NoTitleBar&&&白色背景并无标题栏&&&
oandroid:theme=&Theme.Light.NoTitleBar.Fullscreen&&&白色背景,无标题栏,全屏&&
oandroid:theme=&Theme.Black&&&背景黑色&&
oandroid:theme=&Theme.Black.NoTitleBar&&&黑色背景并无标题栏&&
oandroid:theme=&Theme.Black.NoTitleBar.Fullscreen&&&&&黑色背景,无标题栏,全屏&&
oandroid:theme=&Theme.Wallpaper&&&用系统桌面为应用程序背景&&
oandroid:theme=&Theme.Wallpaper.NoTitleBar&&&用系统桌面为应用程序背景,且无标题栏&&
oandroid:theme=&Theme.Wallpaper.NoTitleBar.Fullscreen&&&用系统桌面为应用程序背景,无标题栏,全屏&&
oandroid:theme=&Translucent&&&半透明&&
oandroid:theme=&Theme.Translucent.NoTitleBar&&半透明、无标题栏&&
oandroid:theme=&Theme.Translucent.NoTitleBar.Fullscreen&&半透明、无标题栏、全屏&&
oandroid:theme=&Theme.Panel&&&
oandroid:theme=&Theme.Light.Panel&&&
这些主题可以应用到整个应用Application范围或者某个活动Activity范围中。
应用Application范围 在AndroidManifest.xml中的application节点中设置theme属性,主题theme应用到整个应用程序中。 &&&&Android:icon=”@drawable/icon” &&&&Android:icon=”@string/app_name” &&&&Android:icon=”@android:style/ Theme.Black.NoTitleBar”&
活动Activity范围 使用java代码或者在AndroidManifest.xml中对活动Activity的主题进行设置,主题仅应用到当前活动中。 在AndroidMainifest.xml设置方法: android:name=“.About” android:label=“@string/app_name” android:theme=“@android:style/ Theme.Black.NoTitleBar” &
使用java代码进行设置,在当前活动Activity的onCreate中进行设置: @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setTheme(android.R.style.Theme_Translucent_NoTitleBar); setContentView(R.layout.main); }
上一编:下一编:
喜欢猜你喜欢的内容
大家感兴趣的内容
1 2 3 4 5 6 7 8 9 10
最近更新的内容
1 2 3 4 5 6 7 8 9 10
本月热门的内容
1 2 3 4 5 6 7 8 9 10

我要回帖

更多关于 安卓刷新activity界面 的文章

 

随机推荐