Создание масштабируемого вида, который перекрывает другие виды? - PullRequest
0 голосов
/ 26 сентября 2018

Я пытаюсь создать вид, в котором заголовок вверху, изображение посередине и ряд кнопок внизу.Мне бы хотелось, чтобы изображение накладывалось поверх всех других видов, чтобы при увеличении изображения оно могло занимать весь экран.У меня это в основном работает, но только на небольших изображениях.Проблема, с которой я сталкиваюсь, заключается в том, что когда я получаю большое (высокое) изображение, оно инициализируется по всей высоте представления, а мои заголовок / кнопки скрываются за изображением.

Как я могу разрешить масштабирование моего изображения во весь вид, а также инициализировать размер изображения, чтобы мои кнопки / заголовок не закрывались, когда пользователь попадает в этот вид?

Я пробовал wrap_content для высоты изображения, и это только ограничивает размер моего увеличенного изображения. Пример изображения, которое дает хорошие результаты:

enter image description here

Пример слишком высокого изображения, дающего плохие результаты:

enter image description here

Мой макет:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBgBlackTintDarkest"
    android:orientation="vertical"
    android:clickable="true"
    >

    <!-- Submission title/subreddit info -->

    <LinearLayout
        android:id="@+id/big_display_title_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_alignParentTop="true"
        android:layout_marginTop="20dp">

        <TextView
            android:id="@+id/big_display_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight=".75"
            android:gravity="center_horizontal"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:text="Title about something random that we found on reddit while browsing yesterday"
            android:textColor="@color/colorWhite"
            android:textSize="18sp"
            />

        <!--subreddit name-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_weight=".25"
            android:orientation="horizontal"
            android:paddingEnd="10dp">

            <View
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight=".5" />

            <TextView
                android:id="@+id/big_display_subreddit"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:layout_weight=".5"
                android:gravity="end"
                android:text="/r/subreddit"
                android:textColor="@color/colorWhite"
                android:textSize="14sp"
                android:textStyle="bold"
                 />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/big_display_snack_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_alignParentBottom="true">


        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="@drawable/ic_white_chat"
            android:id="@+id/big_display_snack_bar_comments"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="@drawable/ic_white_upvote_medium"
            android:id="@+id/big_display_snack_bar_upvote"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="@drawable/ic_white_downvote_medium"
            android:id="@+id/big_display_snack_bar_downvote"/>

        <!-- overflow -->


        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/ic_white_overflow_small"
            android:id="@+id/big_display_snack_bar_overflow"/>

    </LinearLayout>

    <com.github.piasy.biv.view.BigImageView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/big_image_viewer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="true"
        />
</RelativeLayout>
...