2016-12-05 224 views
-1

图像显示在工作室中,但不显示在手机中。 图像放置在水库。 运行于一加一。 使用线性布局图像不显示

<ImageView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:srcCompat="@drawable/wifi" 
     android:id="@+id/imageView3" 
     android:layout_centerHorizontal="true" 
     /> 
+0

请告诉你活动代码。 –

+0

它是一个矢量绘制? –

+0

请检查图片的大小。如果它非常大,然后添加一个小尺寸的图像 – Sayem

回答

-1

通过改变代码,尝试到

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:src="@drawable/wifi" 
    android:id="@+id/imageView3" 
    android:layout_centerHorizontal="true" 
    /> 
0

内部res文件夹有像绘制绘制-LDPI绘制-MDPI绘制,华电国际,drawable-xhdpi etc.

你应该确保你在不在IDPI 绘制文件夹或MDPI

2

你必须添加下面一行到您的根布局复制你的形象。

xmlns:app="http://schemas.android.com/apk/res-auto" 

请看下面的例子。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:background="@color/white" 
    android:clickable="true" 
    android:orientation="vertical"> 

    <ImageView 
      app:srcCompat="@drawable/ic_user_red" 
      android:layout_width="50dp" 
      android:layout_height="50dp"/> 

</LinearLayout> 

没有xmlns:app="http://schemas.android.com/apk/res-auto"不能使用app:srcCompat

+0

你可以...然后你必须给包含这个属性的packagename.classname。 –