嘻嘻
我一直在寻找几个小时,尝试了不同的东西,其中大部分已经包括在内.我希望你们能帮助我显然没有看到的东西.
我在我的片段中有一个SupportMapFragment用于Maps.我以前有这个工作,但由于某种原因它现在崩溃与nullpointer.在搜索了几个小时并阅读了更多文档后,我发现我使用了一种不推荐的方式,因此我尝试使用建议的文件:onMapReady.但是,即使我正在使用它也无法识别该功能
com.google.android.gms.maps.SupportMapFragment
Run Code Online (Sandbox Code Playgroud)
这是我的片段xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frameLayoutMainAct"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<fragment
android:id="@+id/mapView"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:id="@+id/map_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
这是从OnViewCreated开始的代码:
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(MainActivity.getContext()) == ConnectionResult.SUCCESS) {
initMap();
if (locations != null) {
addMarkers();
}
moveMapToCuracao();
}
}
public void initMap() {
final SupportMapFragment myMAPF = (SupportMapFragment) getFragmentManager()
.findFragmentById(mapView);
myMAPF.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
mGoogleMap.setPadding(50, 0, 0, 0);
mGoogleMap.getUiSettings().setMyLocationButtonEnabled(false);
mGoogleMap.setMyLocationEnabled(true);
mGoogleMap …Run Code Online (Sandbox Code Playgroud) 嘻嘻
我很好奇是否有可能将Map转换为JSON,而使用GSON则反之亦然?我放入的对象已经通过GSON从JSON转换为Object.
我正在使用的对象如下所示:
public class Locations{
private List<Location> location;
<-- Getter / Setter -->
public class Location{
<-- Fields and Getters/Setters -->
}
}
Run Code Online (Sandbox Code Playgroud) 嘿伙计们,
所以目前我正在使用PopupWindow来显示应用程序内浏览器.然而,当按下后退按钮时它什么都不做.我在另一个片段中使用PopupWindow,然后我使用一个语句在我的FragmentActivity中设置PopupWindow,然后当我按下我的后退按钮时,它应该检查PopupWindow是否被设置并且不关闭它.但它甚至没有通过onBackPressed运行.
片段中的PopupWindow:
- >是指出确保FragmentActivity获取PopupWindow的行.
// Use webview for icons and website link.
public void inAppBrowser(String url){
mCursor.moveToFirst();
// Inflate View
LayoutInflater layoutInflater = (LayoutInflater) ((MainActivity) MainActivity.getContext()).getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View inflatedView = layoutInflater.inflate(R.layout.browser_window, null, false);
// Control View Childs.
LinearLayout header = (LinearLayout) inflatedView.findViewById(R.id.filter_header);
header.setBackgroundColor(Color.parseColor(color));
Button cancel = (Button) inflatedView.findViewById(R.id.cancel);
Button done = (Button) inflatedView.findViewById(R.id.done);
// Set PopupWindow position.
Display display = ((MainActivity) MainActivity.getContext()).getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
// Control PopupWindow.
final PopupWindow popWindow = new PopupWindow(inflatedView, size.x, size.y, …Run Code Online (Sandbox Code Playgroud) 这与其说是技术问题,不如说是支持问题。但是,如果您设置了 Google 云托管并且想要使用 Firebase。是否包含费用,还是您必须为 Firebase 单独支付费用?
自从谷歌宣布了新的 Firebase,我很好奇它是否包含在包中,或者它是否与谷歌云托管分开,你可以添加它?
目前我正在使用自定义相机应用程序,预览看起来很好.但是当我拍摄照片并在我的其他活动中显示时,图片已经减少了80%.谁知道为什么会这样?同样在画廊,质量很差.我正在使用Android的Camera API Demo .
我的参数:
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
parameters = mCamera.getParameters();
parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
parameters.setFlashMode(Parameters.FLASH_MODE_AUTO);
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
parameters.setJpegQuality(100);
parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
parameters.setRotation(90);
Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
if (display.getRotation() == Surface.ROTATION_0) {
mCamera.setDisplayOrientation(90);
} else if (display.getRotation() == Surface.ROTATION_270) {
mCamera.setDisplayOrientation(180);
}
mCamera.setParameters(parameters);
mCamera.startPreview();
}
Run Code Online (Sandbox Code Playgroud)
代码保存图片:
private PictureCallback mPicture = new PictureCallback() {
private String TAG = "DocsPro";
@Override
public void onPictureTaken(byte[] data, Camera camera) {
File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
if (pictureFile == …Run Code Online (Sandbox Code Playgroud) 我在我的商店模块中访问我的 api 时遇到了困难。我已经创建了我的 api 实例,就像商店一样在我的 vue 创建中传递它。但是,当尝试在我的模块中实现逻辑时, this.$api 无法像在我的组件中那样工作。有什么方法可以访问我已经创建的 api 实例吗?
const api = new Api();
/* eslint-disable no-new */
new Vue({
components: {App},
router,
api, // <--- I want this.
store, // <--- To be accesable in the modules of this
template: '<App/>'
}).$mount('#app');
Run Code Online (Sandbox Code Playgroud)
那么我可以访问 api 实例而不在我的模块或商店中创建新实例吗?
android ×4
camera ×1
dictionary ×1
firebase ×1
google-maps ×1
gson ×1
image ×1
json ×1
object ×1
vue.js ×1
vuex ×1
vuex-modules ×1