为了账号安全,请及时绑定邮箱和手机立即绑定

为什么ImageView显示失败?

为什么ImageView显示失败?

deemos 2017-07-26 22:09:35
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@color/white"     android:orientation="vertical">     <EditText         android:id="@+id/ed1"         android:layout_width="match_parent"         android:layout_height="60dp"         android:layout_margin="15dp"         android:background="@drawable/white_bg"         android:editable="false"         android:gravity="right|center"         android:hint="万岁" />     <TableLayout         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:layout_gravity="center">         <TableRow             android:layout_width="match_parent"             android:layout_height="match_parent">             <ImageView                 android:id="@+id/imageView"                 android:layout_width="90dp"                 android:layout_height="90dp"                 app:srcCompat="@mipmap/shen2" />  //注意!注意!就是这里的图片不显示!!!             <Button                 android:id="@+id/Del"                 android:layout_width="90dp"                 android:layout_height="90dp"                 android:text="@string/Del" />             <Button                 android:id="@+id/Cancel"                 android:layout_width="90dp"                 android:layout_height="90dp"                 android:text="@string/Cancel" />             <Button                 android:id="@+id/division"                 android:layout_width="90dp"                 android:layout_height="90dp"                 android:text="@string/division" />         </TableRow>     </TableLayout> </LinearLayout>我在AS中预览的时候有图片,但在虚拟机上就没有了,我尝试安装到手机上还是不显示。请教各位大神这是什么原因?怎么解决?感激!!!我附上了图片可以看一下,再次感激!!!
查看完整描述

2 回答

已采纳
?
Omooo

TA贡献10条经验 获得超3个赞

明天我可以实验一下,先说一下我的想法,可能不准确。
src是填充一个对象,你给了90dp,可能小了,所以内容填充不进去,你可以试一下用background,让它以背景图的方式填进去。只是我的想法,毕竟没实验。

查看完整回答
2 反对 回复 2017-07-26
  • deemos
    deemos
    行,我明天也可以试试,但是在AS里可以预览出来就很奇怪了,预览是5点几的系统,我是7.0的不应该出现这样的情况按理讲。
  • Omooo
    Omooo
    对呀,毕竟这样的错误只能不断尝试,说也很难说。
  • deemos
    deemos
    好的,还要多试试,感觉AS比较复杂
点击展开后面2
?
liu丶

TA贡献15条经验 获得超32个赞

 srcCompat这个的问题   你换成src试试

查看完整回答
1 反对 回复 2017-07-27
  • deemos
    deemos
    好的,我试试,话说,这两个有什么区别么?
  • deemos
    deemos
    解决了,具体的可以看看我给1楼的回复
  • 2 回答
  • 0 关注
  • 2006 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信