【发布时间】:2018-11-07 09:29:52
【问题描述】:
我正在尝试使用这张世界地图svg,但是当我调整矢量大小以查看新加坡时,它没有缩放。地图变得模糊。更具体地说,我将 imageView 的宽度和高度设置为 36000dp。
这是矢量drawbles的宽度和高度:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="2000dp"
android:height="1001dp"
android:viewportWidth="2000"
android:viewportHeight="1001">
在我的布局文件中,我已经使用了 app:srcCompat 而不是 src: 。
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#3A6F5C">
<ImageView
android:id="@+id/Map_svg"
android:layout_width="36000dp"
android:layout_height="36000dp"
app:srcCompat="@drawable/ic_world_map"
/>
</android.support.constraint.ConstraintLayout>
这是我的 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "com.example.alan_lin.flora_shipanimation"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
当我升级它时,如何防止它变得模糊?谢谢
【问题讨论】:
标签: android android-layout user-interface android-vectordrawable