【问题标题】:How to Show Image View in android?如何在android中显示图像视图?
【发布时间】:2016-02-16 01:20:18
【问题描述】:

对不起,我是java/android的初学者,也许这个问题太糟糕了。

我想在启动画面中显示我的图标,但如果我使用 ic_launcher,它的尺寸太小了。 (192x192)

当我从新图像资产生成 ic_launcher 时,它会在 "app\src\main\ic_launcher-web.png" 中生成大小为 512x512 的图像

我可以显示该图像吗? 我想我可以将@mipmap/ic_launcher 更改为某个路径/图像位置。所以,我不需要将我的图像复制到 drawable/mipmap 目录。

        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:adjustViewBounds="true"
        android:scaleType="fitCenter"
        android:src="@mipmap/ic_launcher" />

我一直在寻找它并没有找到它。 感谢帮助

【问题讨论】:

    标签: java android imageview


    【解决方案1】:

    将您的原始图像保存在res/drawable/youimage.png。然后从

    调用它
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:adjustViewBounds="true"
        android:scaleType="fitCenter"
        android:src="@drawable/yourimage.png" />
    

    【讨论】:

    • 感谢您的回答,是否意味着我必须将图像复制到 drawable/mipmap 目录?
    • 复制到 res/drawable 文件夹就可以了。除非您的绘图具有各种分辨率(例如 hdpi、mdpi 等)
    猜你喜欢
    • 2015-10-21
    • 2017-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多