有没有办法确定缩放级别,以便我的所有标记都适合缩放级别?我正在使用mapbox 0.4.0
我认为答案与此类似,但我找不到Android版本
[ https://www.mapbox.com/mapbox.js/example/v1.0.0/markers-only-at-zoom-level/]
我正在尝试禁用缩放并在地图框中平移mapview.我使用mapbox 0.4.0.目前我可以禁用缩放,但无法禁用平移
MapView mv = (MapView) tab.findViewById(R.id.mapid);
mv.setZoom(14);
mv.setMaxZoomLevel(14);
mv.setMinZoomLevel(14);
Run Code Online (Sandbox Code Playgroud) 我正在尝试将视图寻呼机放在表格行中,并设置视图寻呼机布局高度匹配父级.结果是视图寻呼机根本没有高度.我必须在dp中设置布局高度,以便视图寻呼机可以具有高度.但是我在视图寻呼机内部充气是动态的,因此我无法在xml中设置高度.滚动视图已经填满了屏幕,但是viewpager根本没有任何高度.有没有办法解决这个问题?(有问题的视图寻呼机是具有id pager_problem的视图寻呼机)
编辑:
好了,现在经过我改变它的viewpager存在,但只有那样大屏幕,我想使viewpager滚动里面的内容,如果该片段的内容很长(所有版面滚动,不仅考虑到寻呼机的片段)
<?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">
<com.emilsjolander.components.StickyScrollViewItems.StickyScrollView
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TableRow>
<android.support.v4.view.ViewPager
android:id="@+id/pager_image"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="100dp" />
</TableRow>
<TableRow android:tag="sticky">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="50dp"
android:id="@+id/tab"
android:tag="sticky"
android:layout_below="@id/pager_image"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/frame_general_tab"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="GENERAL"/>
</LinearLayout>
<LinearLayout
android:id="@+id/frame_detail_tab"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:background="@color/gray_F2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="DETAIL"/>
</LinearLayout>
<LinearLayout
android:id="@+id/frame_foto_tab"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:background="@color/gray_F2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="FOTO"/>
</LinearLayout>
</LinearLayout> …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的Android应用程序中使用mapbox.我使用android studio 0.8.0.我在build.gradle文件中包含了这一行
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.4.0@aar'){
transitive=true
}
compile ('com.cocoahero.android:geojson:1.0.0@aar'){
transitive=true
}
Run Code Online (Sandbox Code Playgroud)
但是当我在我的xml文件中使用它时,它有一个命名空间错误.mapbox命名空间导致了这一点.任何想法可能导致什么?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/parent_layout">
<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="15sp"
android:text="this is the general tab"/>
<com.mapbox.mapboxsdk.views.MapView -->not causing error
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
mapbox:mapid="Your MapBox mapid" /> -->causing error
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud) 我正在尝试压缩我保存在文件中的图像.我正在尝试将文件压缩为1MB.我尝试了一些方法,但它通常会产生一个OutofMemoryError.然后我尝试使用此解决方案,但它使位图空白.
这是我的代码:
System.gc();
getActivity().getContentResolver().notifyChange(mImageTempUri, null);
Bitmap bitmap;
bitmap = BitmapFactory.decodeFile(mImageDirectory + mImageName, options);
if(bitmap == null){
howRequestFailedErrorMessage("Gambar gagal di-upload");
return;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 25, bytes);
File f = new File(mImageDirectory + mImageName);
if(f.exists()){
f.delete();
}
FileOutputStream fo;
try {
fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
fo.flush();
fo.close();
} catch (IOException e) {
e.printStackTrace();
}
bitmap.recycle();
Run Code Online (Sandbox Code Playgroud)