This is the image button
image does not shown up as background of imageButton
this is screenshot of imageButton after putting it’s background as image shown
Here is complete content.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:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.meggabyte.comppec.MainActivity"
tools:showIn="@layout/activity_main">
<ImageButton
android:layout_width="300dp"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:id="@+id/imageButton"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_action_name"
android:cropToPadding="false"
/>
2
Answers
Use this code instead:
You didn’t assign an image to your ImageView… You need a line in your XML that says
The background and source are different