缩放绘制资源的XML(安卓) [英] Scale a drawable resource in XML (Android)
本文介绍了缩放绘制资源的XML(安卓)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想缩放绘制到原来size.I'm的双重试图用这样的:的绘制对象Resouces 。我现在的code是:
I'm trying to scale a drawable to the double of its original size.I'm trying to use this: Drawable Resouces. My current code is:
绘制对象:
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_launcher"
android:scaleHeight="80%"
android:scaleWidth="80%" >
</scale>
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/scale2" />
</LinearLayout>
但没有显示在第二个ImageView的。我该如何解决这个问题?
But nothing is shown in the second ImageView. How can I fix it?
推荐答案
绘制对象
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/logo"
android:scaleGravity="center_vertical|center_horizontal"
android:scaleHeight="80%"
android:scaleWidth="80%" />
布局
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/scale" />
尝试这样或者你可以检查此链接。
try like this or you may check this link.
<一个href="http://developer.android.com/guide/topics/resources/drawable-resource.html">http://developer.android.com/guide/topics/resources/drawable-resource.html
这篇关于缩放绘制资源的XML(安卓)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文