假设我们在地图上有一个居中的标记,当我们用手指移动地图时,我们可以看到当你离开该区域时,标记将不再显示.那么我们怎样才能制作一个始终位于地图中心的标记,尽管我们将地图移动到任何地方?有一个名为UBER的应用程序,它们提供此功能,您不要拖放标记,只需移动地图,标记就会保持它的位置.
这是一个截图:
当我们移动地图时,您可以看到绿色标记位于屏幕的中心,它仍然保留其位置,但在用户停止移动地图时显示新位置.我们怎么能这样做?
我有一个代码,当您拖放标记时显示地址,如何重新显示地址但这次不是通过拖动,移动地图?希望你能理解任何想法都会很棒.
public class MainActivity extends AbstractMapActivity implements
OnNavigationListener, OnInfoWindowClickListener,
OnMarkerDragListener {
private static final String STATE_NAV="nav";
private static final int[] MAP_TYPE_NAMES= { R.string.normal,
R.string.hybrid, R.string.satellite, R.string.terrain };
private static final int[] MAP_TYPES= { GoogleMap.MAP_TYPE_NORMAL,
GoogleMap.MAP_TYPE_HYBRID, GoogleMap.MAP_TYPE_SATELLITE,
GoogleMap.MAP_TYPE_TERRAIN };
private GoogleMap map=null;
String filterAddress = "";
Marker marker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (readyToGo()) {
setContentView(R.layout.activity_main);
SupportMapFragment mapFrag=
(SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
mapFrag.setRetainInstance(true);
initListNav();
map=mapFrag.getMap();
if (savedInstanceState == null) {
CameraUpdate center=
CameraUpdateFactory.newLatLng(new LatLng(
41.003739,
28.999572));
CameraUpdate zoom=CameraUpdateFactory.zoomTo(10); …
Run Code Online (Sandbox Code Playgroud) 我知道这个论坛上有相关帖子和其他资源,但我坚持这个并且无法继续.问题是我已经用vs2010做了一个网站,当我把它发布到ftp服务器并导航到url地址我得到了这个错误.这是我做过的事情
- 我已启用IIS服务和静态内容
- 我已经在处理程序映射下恢复为staticFile的父级
- 我在命令提示符下再次注册了asp.net(regiis.exe的东西)
- 在IIS管理器中,我已经在网站下添加了我的网站地址,停止了默认网站并启动了我的网站.
- 我已将我的网站添加到classic.NET AppPool(集成,和v4.0)
- 我已启用默认浏览..
- 我已经完成了所有通常涵盖的建议..
这是我的web.config
<configuration>
<system.webServer>
<directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension" />
<defaultDocument>
<files>
<add value="AnaSayfa.aspx" />
</files>
</defaultDocument>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在哪里做错了?我已经度过了2天,无法前进一寸.如果这个问题解决了,我会泪流满面.任何帮助都会非常,极大,极大!赞赏,将是我的英雄,主人(:谢谢
我试图在我的应用程序中添加一个共享按钮,该按钮获取屏幕截图,然后通过Facebook等进行共享。我已经在互联网上进行了搜索。我也搜索过堆栈溢出;有很多与此问题相关的主题,但我还不能弄清楚。使我感到困惑的是..在每个示例中,图像的文件路径都是硬编码的。我确实喜欢这样,但是它没有用处且动态。我想做的是获取那一刻的屏幕快照,然后共享它,但是当我自己给出文件路径时,它只是从文件夹中拍摄该图片并共享
public void clickButton(View v) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
//set the type
shareIntent.setType("image/png");
//add a subject
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"CAR EXAMPLE");
//build the body of the message to be shared
String shareMessage = "An app...";
//add the message
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage);
//add the img
shareIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("/storage/sdcard0/Tutorial_ScreenShot/screenshot0.jpg"));
//start the chooser for sharing
startActivity(Intent.createChooser(shareIntent, "Share"));
}
Run Code Online (Sandbox Code Playgroud)
如您所见,在添加图像部分中,我自己指定了文件路径。所以如何赋予它更多动态的行为..我的意思是当我单击按钮时,我的应用程序的屏幕必须保存在一个文件夹中,然后我可以共享该文件而无需对其文件路径进行硬编码。
编辑:尝试以下解决方案后;
非常感谢。我已经在按钮的onClick下调用了shareIt(),应用程序停止了……这是日志。
12-28 15:53:01.660: E/AndroidRuntime(14120): FATAL EXCEPTION: main
12-28 15:53:01.660: E/AndroidRuntime(14120): Process: com.hede.namesurfer, PID: 14120
12-28 15:53:01.660: E/AndroidRuntime(14120): java.lang.NullPointerException
12-28 15:53:01.660: E/AndroidRuntime(14120): at
com.hede.namesurfer.MainActivity.share(MainActivity.java:161)
12-28 15:53:01.660: …
Run Code Online (Sandbox Code Playgroud) 嗨,我有一个Android应用程序,可以在Google地图上找到您的位置,但是当我启动该应用程序时,它是从非洲开始的,而不是我当前所在的城市,国家,位置等。我已经在developer.android.com上检查了信息与位置问题有关,但问题仍然存在。
这是代码;有任何想法吗?谢谢..
package com.kodlab.nerdeyim;
import android.location.Location;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
public class MainActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener {
private LocationClient locationClient;
private LocationRequest locationRequest;
private GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
locationClient = new LocationClient(this, this, this);
locationRequest = LocationRequest.create()
.setInterval(5000)
.setFastestInterval(500)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
googleMap = supportMapFragment.getMap();
googleMap.setMyLocationEnabled(true); …
Run Code Online (Sandbox Code Playgroud) 我看过网,却找不到准确的答案.我有一个ImageView
用作地图中心的标记,当我平移地图时它的位置不会改变.当我在地图上停止平移时,我想得到位置的latlng.我想我必须使用投影,但因为我不是那么专业的android我被卡住了.请有人帮忙吗.
android ×4
google-maps ×3
asp.net ×1
iis-7.5 ×1
location ×1
publishing ×1
screenshot ×1
sharing ×1