Android图像未显示在imageview中 [英] Android image not showing in imageview
本文介绍了Android图像未显示在imageview中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的xml文件有问题.我想显示图片,但图片未显示.奇怪的是,我在我的应用程序的另一部分中使用了同一张图片,并且一切正常.我正在使用的照片也显示在android studio中,但没有显示在我的手机上.您可以在下面找到我的xml.
I am having problems with my xml file. I want to show a picture but the picture is not showing. Strange thing is I am using the same picture in an other part of my app and there everithing is working fine. The foto I am using is also showing in android studio but not on my phone. You can find my xml below.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/backgroundcollor">
<ImageView
android:id="@+id/imgPersoon"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="65dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
app:srcCompat="@drawable/persoon" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imgPersoon"
android:fillViewport="false"
android:orientation="vertical"
android:padding="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="14dp"
android:text="Naam:"
android:textAlignment="center"
android:textColor="@color/colorPrimary" />
<EditText
android:id="@+id/txtFirstName"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_below="@+id/txtName"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/rounded_button_grey"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
android:textSize="14sp" />
<EditText
android:id="@+id/txtLastName"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_below="@+id/txtFirstName"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/rounded_button_grey"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
android:textSize="14sp" />
<TextView
android:id="@+id/txtDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/txtLastName"
android:layout_marginTop="14dp"
android:text="Naam:"
android:textAlignment="center"
android:textColor="@color/colorPrimary" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
推荐答案
使用android:src
代替app:srcCompat
这篇关于Android图像未显示在imageview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文