iT邦幫忙

0

如何在android studio 中的 Map Fragment加入imagebutton

目前碰到一個問題,在 Map Fragment我可以加入imagebutton,但是ImageButton圖片會在預覽中出現了,但實際執行時卻看不到圖片。
https://ithelp.ithome.com.tw/upload/images/20210407/20110847485L4TduGW.png
https://ithelp.ithome.com.tw/upload/images/20210407/20110847atmJrUq0fk.png
程式碼如下
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="wrap_content"
    android:layout_height="match_parent">

    <!--fragment to display our maps-->

    <!--search view to search our location-->


    <!--search view to search our location-->

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MapsActivity" />

    <androidx.appcompat.widget.SearchView
        android:id="@+id/Searchaddress"
        android:layout_width="243dp"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp"
        android:layout_marginEnd="89dp"
        android:layout_marginBottom="658dp"
        android:background="#FAFAFA"
        android:elevation="5dp"
        app:iconifiedByDefault="false"
        app:queryHint="Search address">

    </androidx.appcompat.widget.SearchView>

    <ImageButton
        android:id="@+id/imageButton5"
        android:layout_width="275dp"
        android:layout_height="389dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:layout_marginEnd="118dp"
        android:layout_marginBottom="243dp"
        app:srcCompat="@drawable/linux" />


</RelativeLayout>

尚未有邦友回答

立即登入回答