我正在开发一个使用NavigationDrawerie 的应用程序DrawerLayout并导航到不同的Fragments.当我调用Map_Fragment_Page应用程序崩溃时,但不是第一次.这是第一次Map正确显示,但在此之后,当我导航不同的片段并再次出现时,Map_Fragment_Page它会崩溃而产生错误android.view.InflateException: Binary XML file line #8: Error inflating class fragment
我尝试了很多不同的解决方案,我也搜索过Google但仍未获得所需的解决方案.问题尚未解决.
howtoreach.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/howtoreach_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
HowToReach.java
package com.demo.map.howtoreach;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import android.support.v4.app.Fragment;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import com.demo.map.R;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Color;
import android.location.Criteria;
import …Run Code Online (Sandbox Code Playgroud) 我创建了一个应用程序.在我是随机产生latitude,并longitude在GoogleMap并通过该值下页..即CameraPage.但是,在CameraPage上,引脚没有像地图上那样正常掉落..我已经实现了camera-zoom其他方法,但仍然无法正常工作..
请检查屏幕截图..
MapPage

CameraPage

是否有任何解决方案可以缩放相机上的引脚而无需外部变焦控制?
它应该在CameraPage加载时默认缩放..
编辑::
码::
ArrayList<Point> props = new ArrayList<Point>();
props.add(new Point(a_latitude, a_longitude, a_username));
props.add(new Point(b_latitude, b_longitude, b_username));
props.add(new Point(c_latitude, c_longitude, c_username));
props.add(new Point(d_latitude, d_longitude, d_username));
props.add(new Point(e_latitude, e_longitude, e_username));
props.add(new Point(f_latitude, f_longitude, f_username));
props.add(new Point(g_latitude, g_longitude, g_username));
props.add(new Point(h_latitude, h_longitude, h_username));
props.add(new Point(i_latitude, i_longitude, i_username));
props.add(new Point(j_latitude, j_longitude, j_username));
mPaint.setColor(Color.BLACK);
mPaint.setTextSize(30);
mPaint.setStrokeWidth(DpiUtils.getPxFromDpi(getContext(), 2));
mPaint.setAntiAlias(true);
mSpots = new Bitmap[props.size()];
for (int i = 0; i < mSpots.length; …Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,我想拍摄当前屏幕的屏幕截图,但没有标题栏.我知道捕获ScreenShot的代码,但无法自定义它.
码:
munchscreen.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
View v1 = L1.getRootView();
v1.setDrawingCacheEnabled(true);
Bitmap bm = v1.getDrawingCache();
BitmapDrawable bitmapDrawable = new BitmapDrawable(bm);
image = (ImageView) findViewById(R.id.screenshots);
image.setBackgroundDrawable(bitmapDrawable);
}
});
Run Code Online (Sandbox Code Playgroud)
当我点击它Clip然后它应该捕获下面显示的屏幕的屏幕截图,但不应该包括我圈出的部分..
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#D8D5AA"
>
<LinearLayout
android:id="@+id/clip_from_web_linearlayout1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/header"
android:orientation="horizontal"
>
<TextView
android:id="@+id/clip_from_web_textview_back"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Back"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:textColor="#FFFFFF"
android:textSize="18sp"
/>
<TextView
android:id="@+id/clip_from_web_textview_header_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Clip From Web"
android:layout_gravity="center"
android:layout_marginLeft="60dp"
android:textColor="#FFFFFF"
android:textSize="18sp"
/>
<TextView
android:id="@+id/clip_from_web_textview_clip"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Clip"
android:layout_gravity="center" …Run Code Online (Sandbox Code Playgroud) 我重新启动后更新了Android SDK,它说更新ADT(如下图所示).然后我试图从更新https://dl-ssl.google.com/android/eclipse/和http://dl-ssl.google.com/android/eclipse/这一点.但它说,
Cannot complete the install because of a conflicting dependency.
Software being installed: Android Development Tools 23.0.3.1327240 (com.android.ide.eclipse.adt.feature.feature.group 23.0.3.1327240)
Software currently installed: Android Development Tools 22.6.2.v201403212031-1085508 (com.android.ide.eclipse.adt.feature.group 22.6.2.v201403212031-1085508)
Only one of the following can be installed at once:
ADT XML Overlay 23.0.3.1327240 (overlay.com.android.ide.eclipse.adt.overlay 23.0.3.1327240)
ADT XML Overlay 22.6.2.v201403212031-1085508 (overlay.com.android.ide.eclipse.adt.overlay 22.6.2.v201403212031-1085508)
Cannot satisfy dependency:
From: Android Development Tools 23.0.3.1327240 (com.android.ide.eclipse.adt.feature.feature.group 23.0.3.1327240)
To: overlay.com.android.ide.eclipse.adt.overlay [23.0.3.1327240]
Cannot satisfy dependency:
From: Android Development Tools 22.6.2.v201403212031-1085508 (com.android.ide.eclipse.adt.feature.group 22.6.2.v201403212031-1085508)
To: overlay.com.android.ide.eclipse.adt.overlay …
我正在开发一个应用程序,因为我想从资产中显示一个pdf文件.我做了很多谷歌,并尝试了多种排列和组合,但没有工作.
码:
private void CopyReadAssets()
{
AssetManager assetManager = getActivity().getAssets();
InputStream in = null;
OutputStream out = null;
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/abc.pdf");
try
{
in = assetManager.open("abc.pdf");
out = getActivity().openFileOutput(file.getName(), Context.MODE_WORLD_READABLE);
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
}
catch (Exception e)
{
Log.e("tag", e.getMessage());
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
private void copyFile(InputStream in, OutputStream out) throws IOException
{
byte[] buffer = new byte[1024];
int read;
while ((read = …Run Code Online (Sandbox Code Playgroud)