在XML Android的位图图像大小 [英] Android bitmap image size in xml
本文介绍了在XML Android的位图图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的XML文件中,我使用位图作为以下
In my xml file, i am using bitmap as the following
<bitmap
android:src="@drawable/Icon"
android:gravity="center"/>
下面的图标的图像宽度超过屏幕。
Here the image width of the icon exceeds the screen.
我试过机器人:宽=100dp和所有。但它不工作。
I tried android:width="100dp" and all. But it isn't working.
整个XML文件:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<stroke android:width="3dp" android:color="@color/black" />
<solid android:color="@color/bg_green" />
</shape>
</item>
<item>
<bitmap
android:src="@drawable/Icon"
android:gravity="center"/>
</item>
</layer-list>
我怎样才能减少上述位图的宽度和高度?
How can i reduce the width and height of the above bitmap?
请帮忙,
谢谢
Please help, Thanks
推荐答案
尝试使用的ImageView
而不是:
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="center"
android:src="@drawable/Icon" />
更新:
Android开发者我看到有没有标签的位图XML,让你去改变它的大小。你需要通过某些图形应用程序做到这一点。
From Android Developers I saw that there is no tag for Bitmap XML that allow you to change it size. You need to do this via some Graphic Applications
这篇关于在XML Android的位图图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文