skip to Main Content

When inserting two images into Android Studio’s Relative Layout, as shown in the photo below, you can see that images have been inserted into DrawableBottom, Foreground, and Icon:

enter image description here

But when running the same graphical interface on the mobile, the images do not appear. Please, what to do for the images to appear? It’s in the Relative Layout of Android Studio.

enter image description here

2

Answers


  1. For your case I think should do this to show
    android:background:"@drawable/seta_direita"

    Button:

    <Button
           android:id="@+id/btn"
           android:layout_width="24dp"
           android:layout_height="24dp"
           android:background="@drawable/seta_direita"/>
    

    RelativeLayout:

     <RelativeLayout
               android:id="@+id/layout"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:background="@drawable/seta_direita">
     </RelativeLayout>  
    
    Login or Signup to reply.
  2. As you using just an image as background you should use ImageButton, not a regular Button.

            <ImageButton
                android:id="@+id/btnSetaDireita"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:src="@drawable/seta_direita"/>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search