Android - ImageButton image is not displayed [duplicate]

1

I'm trying to put 3 ImageButtons in a LinearLayout. The background image I am using are drawable images that I added by clicking the following sequence in Android Studio (2.2.2): Right click on the drawable, new, vector asset folder and choose which icon to add. After that I add a LinearLayout to the activity_main.xml file and add the 3 ImageButton to it. In my Android Studio design looks like this:

ButwhenIrunatest,whetheronthephoneortheAndroidemulatoritself,itstaysthatway,thebuttonsdonotappear.Onlysomeofthemaredisplayed:

Belowistheacitivity_main.xmlfile

<?xmlversion="1.0" encoding="utf-8"?>

<FrameLayout  
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:keepScreenOn="true"
android:background="@android:color/background_dark"
android:id="@+id/myMainActivity"
tools:context="com.example.root.dtvplayer.MainActivity">

<FrameLayout
    android:id="@+id/video_surface_frame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:foregroundGravity="clip_horizontal|clip_vertical"
    tools:ignore="true">

    <SurfaceView
        android:id="@+id/video_surface"
        android:layout_width="1dp"
        android:layout_height="1dp" />

    <ViewStub
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout="@layout/activity_subtitles_surface"
        android:id="@+id/subtitles_stub" />

</FrameLayout>

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom">

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_expand_less_black_24dp"
        android:id="@+id/imageButton24"
        android:layout_weight="1" />

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_expand_more_black_24dp"
        android:id="@+id/imageButton25"
        android:layout_weight="1" />

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_youtube_searched_for_black_24dp"
        android:id="@+id/imageButton26"
        android:layout_weight="1" />
</LinearLayout>

Where am I going wrong?

HOW YOU FIT WITH THE SUGGESTED CHANGE

    <?xml version="1.0" encoding="utf-8"?>

<FrameLayout 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:keepScreenOn="true"
android:background="@android:color/background_dark"
android:id="@+id/myMainActivity"
tools:context="com.example.root.dtvplayer.MainActivity">

    <FrameLayout
        android:id="@+id/video_surface_frame"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:foregroundGravity="clip_horizontal|clip_vertical"
        tools:ignore="true">

        <SurfaceView
            android:id="@+id/video_surface"
            android:layout_width="1dp"
            android:layout_height="1dp" />

        <ViewStub
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout="@layout/activity_subtitles_surface"
            android:id="@+id/subtitles_stub" />

    </FrameLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:id="@+id/linearLayoutControls">

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@android:drawable/arrow_up_float"
            android:id="@+id/imgBtnUpChannel"
            android:contentDescription="" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@android:drawable/arrow_down_float"
            android:id="@+id/imgBtnDownChannel"
            android:contentDescription="" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@android:drawable/ic_menu_search"
            android:id="@+id/imgBtnSearchChannel"
            android:contentDescription="" />
    </LinearLayout>

</FrameLayout>
    
asked by anonymous 02.12.2016 / 15:46

1 answer

3

Modify the 3 app:srcCompat to android:src

    
02.12.2016 / 17:20