加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在XML中扩展可绘制资源(Android)

发布时间:2020-12-16 07:57:10 所属栏目:百科 来源:网络整理
导读:我正在尝试将drawable缩放到其原始大小的两倍.我正在尝试使用它: Drawable Resouces.我当前的代码是: 绘制对象: ?xml version="1.0" encoding="utf-8"?scale xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/ic
我正在尝试将drawable缩放到其原始大小的两倍.我正在尝试使用它: Drawable Resouces.我当前的代码是:

绘制对象:

<?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中没有显示任何内容.我该如何解决?

可绘制
<?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" />

尝试这样或你可以查看此链接.

http://developer.android.com/guide/topics/resources/drawable-resource.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读