2017-02-08 90 views
0

此活动根本不打开我的图像,但文字仍然打开。我尝试了.png和.jpg。我也试过@撤消仍然没有结果。当我运行Android Studios时,没有任何图像显示。

Java代码

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_images); 
} 

XML脚本

<?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" 
android:layout_width="match_parent" android:layout_height="match_parent"> 


<TextView 
    android:text="JUST WORK!!!" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView" 
    android:textAppearance="@style/TextAppearance.AppCompat.Display2" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentEnd="true" 
    android:layout_marginEnd="58dp" 
    android:layout_marginBottom="177dp" /> 

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:srcCompat="@mipmap/ic_launcher" 
    android:layout_above="@+id/textView" 
    android:layout_centerHorizontal="true" 
    android:layout_marginBottom="120dp" 
    android:id="@+id/imageView2" /> 
</RelativeLayout> 

预先感谢您

+1

使用可以使用android:src =“@ drawable/yourimage” –

+1

记住取下你唯一有用的问题吗? – Chisko

回答

0

你的代码看起来还好。

尝试在您的可绘制文件夹中添加您的图像。

并添加,

机器人:SRC = “@绘制/ yourimage”

在您的ImageView XML组件

相关问题