【发布时间】:2017-04-13 13:41:30
【问题描述】:
所以,我想制作一个带有可点击国家的可滚动世界地图。所以当我发现有类似VectorDrawables 的东西时,我决定试一试。
接下来我从SVG 中创建了一个VectorDrawable xml 文件,并尝试将其放入我的ImageView 中。在搜索一些信息时,我发现有 101 种方法可以做到这一点,但没有一种对我有用......
有趣的是,当我在ImageView 中的activity.xml 中添加"android:src="@raw/worldmap" 时,地图会显示在预览中,但每当我尝试运行该应用程序时,它就会崩溃。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="@+id/activity_show_hint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.bert.myapplication.ShowHintActivity"
android:weightSum="1">
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:scaleType="center"
android:src="@raw/worldmap">
</ImageView>
</LinearLayout>
【问题讨论】:
-
您在哪个操作系统上运行?
-
我正在运行 Ubuntu 16.04.2
标签: java android imageview android-vectordrawable