ImageView не отображается в линейном макете, который находится внутри scrollview - PullRequest
0 голосов
/ 16 июня 2020

Я пытаюсь иметь два прокручиваемых элемента внутри моего scrollview, поэтому я помещаю линейный макет в вид прокрутки, а внутри линейного макета я помещаю изображение и текст. Текстовое изображение отображается, а изображение - нет. В чем проблема?

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

<LinearLayout 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:orientation="vertical"
    android:paddingStart="@dimen/layout_padding"
    android:paddingEnd="@dimen/layout_padding"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/name_text"
        style="@style/NameStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/name"
        android:textAlignment="center" />

    <ImageView
        android:id="@+id/star_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:contentDescription="@string/yellow_star"
        app:srcCompat="@android:drawable/btn_star_big_on" />


    <ScrollView
        android:id="@+id/bio_scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/profile_picture"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/layout_margin"
                android:contentDescription="@string/profile_picture"
                tools:srcCompat="@mipmap/image" />

            <TextView
                android:id="@+id/bio_text"
                style="@style/NameStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:lineSpacingMultiplier="1.2"
                android:text="@string/bio" />
        </LinearLayout>

    </ScrollView>

</LinearLayout>

1 Ответ

0 голосов
/ 16 июня 2020

Решено: мне не хватало этой строки: app: srcCompat = "@ mipmap / image"

Я чувствую себя тупым

...