Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 小型设备(480x854)上的布局没有响应_Android_Android View_Android Constraintlayout - Fatal编程技术网

Android 小型设备(480x854)上的布局没有响应

Android 小型设备(480x854)上的布局没有响应,android,android-view,android-constraintlayout,Android,Android View,Android Constraintlayout,我正试图创建一个新的布局,但对于LG k4(480x854),该布局的顶部已被切割。 我暂时不想用卷轴 像素2 lgk4 注意:我不能更改按钮或其他组件之间的边距。这是该项目的一项要求 有没有办法创建此布局 多谢各位 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.co

我正试图创建一个新的布局,但对于LG k4(480x854),该布局的顶部已被切割。 我暂时不想用卷轴

像素2

lgk4

注意:我不能更改按钮或其他组件之间的边距。这是该项目的一项要求

有没有办法创建此布局

多谢各位

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".view.allcreatures.AllCreaturesActivity"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toTopOf="@+id/animal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/creature_dino_01" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.41" />

    <TextView
        android:id="@+id/animal"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="This animal is amazing"
        android:textColor="@android:color/holo_green_dark"
        android:textSize="45sp"
        app:layout_constraintBottom_toTopOf="@+id/textView2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="Dinosaurs went extinct about 65 million years ago (at the end of the Cretaceous Period), after living on Earth for about 165 million years."
        android:textSize="15sp"
        app:layout_constraintBottom_toTopOf="@+id/button"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/animal" />

    <Button
        android:id="@+id/button"
        android:layout_width="0dp"
        android:layout_height="56dp"
        android:layout_marginTop="24dp"
        android:text="Button"
        app:layout_constraintBottom_toTopOf="@+id/button2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView2" />

    <Button
        android:id="@+id/button2"
        android:layout_width="0dp"
        android:layout_height="56dp"
        android:layout_marginTop="24dp"
        android:text="Button"
        app:layout_constraintBottom_toTopOf="@+id/textView3"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="English is a complicated, but popular language. It’s one of the most popular languages in the world, in fact, and it’s prevalent in many countries. Learning English is a bit tough, but rewarding because you can use it almost anywhere. There are a surprising number of apps to help people learning English. They fall into a few different categories.  "
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button2" />
</androidx.constraintlayout.widget.ConstraintLayout>


对于现在以及仅仅是做项目,我建议为您的
图像视图设置一个
固定大小
,就像
android:layout\u width=“100dp”
一样,并更改大小,直到您的按钮可见。

尝试在滚动视图中包装您的布局?嗨,胡安,暂时我不想使用滚动视图。项目要求在不使用滚动视图的情况下调整布局的大小:(将所有内容包装在LinearLayout中,并为每个内容指定权重号。这样,您就不会得到加号。强制使用ConstraintLayout?您的
视图
不会被约束到父视图的底部,这就是为什么它们在较小屏幕上被截断的原因。您需要将所有内容设置为垂直链和约束。)它位于父级的底部。