我正在尝试创建一个带有居中图标的颜色绘制的可绘制对象。我尝试创建图层列表,但它会缩放图标以匹配可绘制大小:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/colorImageHolder"/>
</shape>
</item>
<item android:drawable="@drawable/no_photo" android:gravity="center">
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
这是一个真实的设备图片:
我希望它看起来像这样:
有没有办法禁用图标缩放?
更新:我ImageView有scaleType="centerCrop",我认为这是问题的根源:(我试图将 no_photo drawable 作为背景,但它再次缩放。
我必须在Ubuntu 16.04(现有服务器)上安装mapnik/mapnik-python这两个库编译没有任何问题,但python mapnik模块不起作用.导入mapnik模块后,我收到错误:
/home/user# python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mapnik/__init__.py", line 1075, in <module>
register_plugins()
File "mapnik/__init__.py", line 1057, in register_plugins
DatasourceCache.register_datasources(path)
Boost.Python.ArgumentError: Python argument types in
DatasourceCache.register_datasources(str)
did not match C++ signature:
register_datasources(std::string)
>>>
Run Code Online (Sandbox Code Playgroud)
模块与libboost 1.58链接:
/usr/local/lib/python2.7/dist-packages/mapnik-0.1-py2.7-linux-x86_64.egg/mapnik# ldd _mapnik.so
linux-vdso.so.1 => (0x00007ffc3f7fb000)
libmapnik.so.3.0 => /usr/local/lib/libmapnik.so.3.0 (0x00007f093ad96000)
libz.so.1 …Run Code Online (Sandbox Code Playgroud)