Не отображается полноэкранное изображение при поступлении json данных. - PullRequest
1 голос
/ 30 января 2020

enter image description here

Я получаю данные json длинными, и мне нужно прокрутить представление, чтобы получить кнопки ниже. Как я могу сделать кнопку отображения. Когда я пытаюсь дать scrollview его не работает.

1 Ответ

1 голос
/ 30 января 2020

Я изменил структуру вашего макета. Я решил вашу проблему, добавив Относительный макет и назначив фиксированную высоту для scrollview, поскольку ваш сценарий очень ясно показывает, что вы хотите, чтобы все кнопки были видны при прокрутке только содержания вопроса. Итак, вот ваше решение, просто скопируйте и вставьте xml в xml. :)

<?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">
    <androidx.appcompat.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#3D996C">
    </androidx.appcompat.widget.Toolbar>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <LinearLayout
            android:id="@+id/timer_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#3D996C"
            android:layout_alignParentTop="true"
            android:orientation="horizontal">


                <ImageButton
                    android:id="@+id/play_timmer"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="20dp"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="20dp"

                    android:layout_marginBottom="20dp"
                    android:backgroundTint="@color/cardview_shadow_end_color"
                    android:src="@drawable/ic_play">

                </ImageButton>
                <TextView
                    android:id="@+id/timmer_value"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:text="@string/_2_30_30"
                    android:textAlignment="center"
                    android:textColor="#FFF"
                    android:textSize="24sp">
                </TextView>

                <ImageButton
                    android:id="@+id/navigation_stop"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20dp"
                    android:layout_marginEnd="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginBottom="20dp"
                    android:backgroundTint="@color/cardview_shadow_end_color"
                    android:src="@drawable/ic_stop">

                </ImageButton>
        </LinearLayout>
        <LinearLayout
            android:id="@+id/layout_previos_skip"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_below="@+id/timer_layout"
            android:weightSum="3">
            <Button
                android:id="@+id/previous_page"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="10dp"
                android:layout_weight="1"
                android:background="#3D996C"
                android:text="Previous"
                android:textColor="#FFF">
            </Button>
            <TextView
                android:id="@+id/score_card"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="10dp"
                android:layout_marginRight="5dp"
                android:layout_weight="1"
                android:gravity="center"
                android:text="2/200"
                android:textSize="24sp"
                android:textStyle="bold">

            </TextView>


            <Button
                android:id="@+id/skip_page"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:layout_marginRight="10dp"
                android:layout_weight="1"
                android:background="#3D996C"
                android:text="SKIP"
                android:textColor="#FFF" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/question_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_below="@+id/layout_previos_skip"
            android:orientation="vertical">

            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="200dp">
            <TextView
                android:id="@+id/questions_number"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="Question no 1"
                android:textSize="18sp"
                android:textStyle="bold">
            </TextView>
            </ScrollView>
        </LinearLayout>
        <ProgressBar
            android:id="@+id/progressbar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:visibility="gone">
        </ProgressBar>
        <LinearLayout
            android:id="@+id/radioGroup"
            android:layout_below="@+id/question_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="vertical">
            <RadioGroup
                android:id="@+id/answers_group"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp">
                <RadioButton
                    android:id="@+id/answer1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="ANSWER 1">
                </RadioButton>
                <RadioButton
                    android:id="@+id/answer2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="ANSWER 2">
                </RadioButton>
                <RadioButton
                    android:id="@+id/answer3"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="ANSWER 3">
                </RadioButton>
                <RadioButton
                    android:id="@+id/answer4"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="ANSWER 4">
                </RadioButton>
            </RadioGroup>
        </LinearLayout>
        <Button

            android:id="@+id/submit_and_procced"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginBottom="20dp"
            android:background="#ed9c28"
            android:padding="20dp"
            android:text="SUBMIT AND PROCEED"
            android:textColor="#6F0606"
            android:layout_below="@+id/radioGroup"
            >
        </Button>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="bottom"
            android:orientation="vertical"
            android:layout_alignParentBottom="true"
            >
            <LinearLayout
                android:id="@+id/last_page"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:weightSum="2">
                <Button
                    android:id="@+id/skipped"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#ed9c28"
                    android:text="SKIPPED"
                    android:textColor="#831212"
                    android:textSize="18sp">

                </Button>
                <Button
                    android:id="@+id/answered"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#3D996C"
                    android:text="ANSWERED"
                    android:textColor="#00695C"
                    android:textSize="18sp">
                </Button>
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</LinearLayout>
...