小编Fra*_*nke的帖子

有没有办法在OpenLayers 3中禁用旋转?

我目前正将OpenLayers 2 Mapview升级到OpenLayers 3.我非常喜欢新的OpenLayers客户端,但我想停用在移动设备上旋转地图的功能(用2个手指旋转).

但我找不到任何设置.这是不可能的,还是我只是愚蠢地找到设置?

我正在使用openlayers javascript客户端的当前发行版本(3.0.0).(https://github.com/openlayers/ol3/releases/tag/v3.0.0)

javascript openlayers openlayers-3

11
推荐指数
2
解决办法
7427
查看次数

BitmapFactory返回比源更大的图像

嗨,我正在从名为的png图像创建一个位图image.png.图像的尺寸为75(宽度)×92(高度).当我运行此代码时:

Bitmap bitmap = BitmapFactory.decodeResource(this.context.getResources(),  R.drawable.image
Log.d("image", "height: " + bitmap.getHeight() + " width: " + bitmap.getWidth());
Run Code Online (Sandbox Code Playgroud)

记录器日志:

DEBUG/image(3550): height: 138 width: 113
Run Code Online (Sandbox Code Playgroud)

并且屏幕上的图像比尺寸为75 x 92的其他图像大.我可以做什么来让android加载具有正确尺寸的图像?

android bitmapfactory

9
推荐指数
2
解决办法
8250
查看次数

如何在打字稿中迭代字符串文字类型

如何在打字稿中迭代字符串文字类型?

例如我定义这种类型

type Name = "Bill Gates" | "Steve Jobs" | "Linus Torvalds";
Run Code Online (Sandbox Code Playgroud)

我想这样迭代

for (let name of Name) {
    console.log("Possible name: " + name);
}
Run Code Online (Sandbox Code Playgroud)

还是在打字稿中根本不可能?

enums typescript

6
推荐指数
3
解决办法
3473
查看次数

FindViewByID为CustomView返回null

我在android中再次遇到findViewById问题.我的Activity永远不会退出while循环,因为listview始终为null.我已经尝试过重建了.我知道onFinishedInflating方法的视图,但它对我的Activity没有帮助.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.list_with_compass);

    ListWithCompassView lv = (ListWithCompassView) this.findViewById(R.id.compass_list);

    while(lv == null) {
        Log.d("waiting", "waiting1");
        lv = (ListWithCompassView) this.findViewById(R.id.compass_list);
    }
    this.setListView();
}
Run Code Online (Sandbox Code Playgroud)

这是XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/linear_layout_compass" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
    <karsunke.view.ListWithCompassView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/compass_list">
    </karsunke.view.ListWithCompassView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

null android

4
推荐指数
1
解决办法
2618
查看次数