小编Hec*_*888的帖子

如何将两个位图合并到另一个位图

我有两个图像,我想将一个位图图像精确地保存在另一个位置,在它存在的同一点我也使用手势移动图像.

public Bitmap combineImages(Bitmap ScaledBitmap, Bitmap bit) {

        int X = bit.getWidth();
        int Y = bit.getHeight();

        Scaled_X = ScaledBitmap.getWidth();
        scaled_Y = ScaledBitmap.getHeight();

        System.out.println("Combined Images");

        System.out.println("Bit :" + X + "/t" + Y);

        System.out.println("SCaled_Bitmap :" + Scaled_X + "\t" + scaled_Y);

        overlaybitmap = Bitmap.createBitmap(ScaledBitmap.getWidth(),
                ScaledBitmap.getHeight(), ScaledBitmap.getConfig());
        Canvas canvas = new Canvas(overlaybitmap);
        canvas.drawBitmap(ScaledBitmap, new Matrix(), null);
        canvas.drawBitmap(bit, new Matrix(), null);

        return overlaybitmap;
    }
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激.

java android

24
推荐指数
2
解决办法
3万
查看次数

React -Native“经度值不能从字符串转换为双精度”

我正在使用react-native-maps并且使用此代码得到纬度和经度:

callLocation(that) {
  navigator.geolocation.getCurrentPosition(
    position => {
      const currentLongitude = JSON.stringify(position.coords.longitude);
      const currentLatitude = JSON.stringify(position.coords.latitude);
      that.setState({ currentLongitude: currentLongitude });
      that.setState({ currentLatitude: currentLatitude });
    },
    error => alert(error.message),
    { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }
  );
  that.watchID = navigator.geolocation.watchPosition(position => {
    console.log(position);
    const currentLongitude = JSON.stringify(position.coords.longitude);
    const currentLatitude = JSON.stringify(position.coords.latitude);
    that.setState({ currentLongitude: currentLongitude });
    that.setState({ currentLatitude: currentLatitude });
  });
}
Run Code Online (Sandbox Code Playgroud)

这是我的地图视图代码:

<MapView
  style={styles.map}
  initialRegion={{
    latitude: this.state.currentLatitude,
    longitude: this.state.currentLongitude,
    latitudeDelta: 0.0922,
    longitudeDelta: 0.0421
  }}
/>
Run Code Online (Sandbox Code Playgroud)

当我将这个纬度和经度粘贴到我的代码中时,出现以下错误:

reactjs react-native react-native-maps

2
推荐指数
1
解决办法
6496
查看次数

标签 统计

android ×1

java ×1

react-native ×1

react-native-maps ×1

reactjs ×1