В моем графическом макете в студии Android я вижу изображения на своем изображении, но когда я запускаю свое приложение на эмуляторе, изображения на кнопке с изображением не получаются Я добавил скриншоты того, что я вижу в своей студии Android, и что получаю, когда запускаю приложение на эмуляторе. Изображение из ImageButton не отображается на эмуляторе из Android Studio
Я также прилагаю мой 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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_calc"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.sameer.coolcalc.CalcActivity"
tools:background="@android:color/background_light">
<LinearLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:weightSum="6"
android:layout_width="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@android:color/holo_blue_bright"
android:weightSum="1">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="numberDecimal"
android:ems="10"
android:id="@+id/editText4"
android:text="567"
android:textSize="60sp"
android:gravity="center_vertical|end" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:weightSum="4">
<Button
android:text="7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button14"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<Button
android:text="8"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button13"
android:layout_weight="1"
android:textSize="36sp"
android:textColor="@android:color/black"
android:background="@android:color/background_light" />
<Button
android:text="9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button12"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<ImageButton
android:layout_height="match_parent"
app:srcCompat="@drawable/divide"
android:id="@+id/imageButton6"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@android:color/background_light" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:text="4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button3"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<Button
android:text="5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button2"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<Button
android:text="6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/multiply"
android:id="@+id/imageButton"
android:layout_weight="1"
android:background="@android:color/background_light" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:weightSum="4">
<Button
android:text="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button6"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<Button
android:text="2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button5"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<Button
android:text="3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/button4"
android:layout_weight="1"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/subtract"
android:id="@+id/imageButton3"
android:layout_weight="1"
android:background="@android:color/background_light" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:orientation="horizontal"
android:layout_height="match_parent"
android:background="@android:color/background_light"
android:layout_width="205dp"
android:gravity="center">
<Button
android:text="clear"
android:id="@+id/button15"
android:background="@android:color/holo_blue_bright"
android:layout_width="170dp"
android:layout_height="50dp"
android:textSize="30sp" />
</LinearLayout>
<Button
android:text="0"
android:layout_height="match_parent"
android:id="@+id/button11"
android:layout_width="103dp"
android:background="@android:color/background_light"
android:textColor="@android:color/black"
android:textSize="36sp" />
<ImageButton
android:layout_width="103dp"
android:layout_height="match_parent"
app:srcCompat="@drawable/add"
android:id="@+id/imageButton5"
android:background="@android:color/background_light" />
</LinearLayout>
</LinearLayout>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/equal"
android:id="@+id/imageButton7"
android:background="@android:color/transparent"
android:layout_alignParentEnd="true"
android:layout_marginTop="140dp" />
</RelativeLayout>
Использование Android: ЦСИ вместо приложения: srcCompat – AndroidRuntimeException
@ AgustinSivoplás yea, который работал, но я не получил разницу между Android: src и app: srcCompat.Can вы plzz объясните это? –