#scrollview
Вопрос:
Я использовал ограничения по рекомендациям для своего простого приложения, чтобы приспособиться к различным размерам экрана, но все еще испытываю проблемы с экранами меньшего размера, когда кнопки отрезаны от нижней части экрана. Я пытался включить представление прокрутки, чтобы противостоять этому, но изо всех сил пытаюсь заставить его работать?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:background="@drawable/background"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@ id/imageView"
android:layout_width="331dp"
android:layout_height="144dp"
android:layout_marginTop="28dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="@id/guideline2"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logo" />
<TextView
android:id="@ id/textView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="196dp"
android:fontFamily="@font/domine"
android:gravity="center_horizontal"
android:text="Welcome to our notifications app. Please ensure you have notifications enabled."
android:textColor="#ffffff"
android:textSize="20sp"
android:typeface="normal"
app:layout_constraintDimensionRatio="10:3"
app:layout_constraintEnd_toEndOf="@id/guideline2"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@ id/phone"
style="@android:style/Widget.Holo.ImageButton"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="312dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="@id/guideline4"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="@id/guideline3"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@android:drawable/stat_sys_phone_call" />
<Button
android:id="@ id/facebookBtn"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="476dp"
android:background="@drawable/buttonface"
android:drawablePadding="24dp"
android:text="Follow us on Facebook"
android:textSize="12sp"
app:backgroundTint="@null"
app:layout_constraintDimensionRatio="6:1"
app:layout_constraintEnd_toEndOf="@id/guideline2"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@ id/instagram"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="556dp"
android:background="@drawable/buttoninsta"
android:drawablePadding="24dp"
android:text="Follow us on Instagram"
android:textSize="12sp"
app:backgroundTint="@null"
app:layout_constraintDimensionRatio="6:1"
app:layout_constraintEnd_toEndOf="@id/guideline2"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@ id/website"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="640dp"
android:background="@drawable/buttonweb"
android:drawablePadding="24dp"
android:text="Visit our Website"
android:textSize="12sp"
app:backgroundTint="@null"
app:layout_constraintDimensionRatio="6:1"
app:layout_constraintEnd_toEndOf="@id/guideline2"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@ id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.10" />
<androidx.constraintlayout.widget.Guideline
android:id="@ id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.90" />
<androidx.constraintlayout.widget.Guideline
android:id="@ id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.35" />
<androidx.constraintlayout.widget.Guideline
android:id="@ id/guideline4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.65" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>