为什么我的整个LineairLayout都没有显示?

丹妮尔

我正在创建一个自定义对话框。我有2个按钮,“选择其他卡”和“确定”,但不知何故“确定”按钮不会显示。我是使用LineairLayouts的新手。我有一个垂直的水平布局。

对话框显示的内容:

在此处输入图片说明

我希望对话框显示的内容:

在此处输入图片说明

<?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:padding="5dp"
    android:background="@color/colorLightBlue"
    android:onClick="selectOtherCardsButtonClick">


    <TextView
        android:id="@+id/finishedTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginStart="16dp"

        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:fontFamily="@font/patrickhand_regular"
        android:text="@string/finishedCards"
        android:textColor="@color/colorWhite"
        android:textSize="20sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toTopOf="@+id/selectOtherButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:padding="5dp">

        <Button
            android:id="@+id/selectOtherButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginBottom="16dp"

            android:background="@drawable/button_background"
            android:text="@string/selectOtherCards"
            android:textColor="@color/colorWhite"
            android:textSize="20sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/okButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginTop="16dp"
            android:layout_marginBottom="16dp"

            android:background="@drawable/button_background"
            android:text="@string/ok"
            android:textColor="@color/colorWhite"
            android:textSize="20sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/selectOtherButton"
            app:layout_constraintTop_toTopOf="parent" />
    </LinearLayout>

</LinearLayout>

我希望任何人都知道我的问题是什么。

谢谢你的帮忙!

去世

可能selectOtherButton覆盖了所有水平空间,并且在okButton下方selectOtherButton

使用android:layout_weight两个按钮属性,定义将覆盖每个按钮的空间的权重,例如4到1(或调整它以适合您的设计)

   <Button
        android:id="@+id/selectOtherButton"
        android:layout_weight="4"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"

        android:background="@drawable/button_background"
        android:text="@string/selectOtherCards"
        android:textColor="@color/colorWhite"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/okButton"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"

        android:background="@drawable/button_background"
        android:text="@string/ok"
        android:textColor="@color/colorWhite"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/selectOtherButton"
        app:layout_constraintTop_toTopOf="parent" />

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么整个部分都没有显示背景

来自分类Dev

在Spyder上使用Altair时,为什么我的两个图形都没有显示?

来自分类Dev

我可以在整个PHP脚本中将“”(什么都没有)定义为“ 0”吗?

来自分类Dev

为什么什么都没有出现?

来自分类Dev

为什么$ 1输出什么都没有?

来自分类Dev

为什么LongListSelector selectedItem什么都没有?

来自分类Dev

为什么$ 1输出什么都没有?

来自分类Dev

为什么我的所有流程都没有立即开始?

来自分类Dev

带有CardView的RecyclerView:什么都没有显示

来自分类Dev

为什么我的每个循环都没有返回任何东西?

来自分类Dev

为什么我的每个单词反转代码都没有反转某些单词?

来自分类Dev

为什么单击或更改事件都没有触发我的功能?

来自分类Dev

为什么在每行之后都没有打印?

来自分类Dev

为什么在每行之后都没有打印?

来自分类Dev

网页的CSS错误..什么都没有显示

来自分类Dev

嵌入jQuery日历插件-什么都没有显示?

来自分类Dev

JFrame中什么都没有显示

来自分类Dev

我的$ {document).ready里面什么都没有

来自分类Dev

硬盘快满了,但是我什么都没有

来自分类Dev

代码和SQL查询中有什么错误?为什么网页上什么都没有显示?

来自分类Dev

我的cron没有运行,在/ var / mail / <用户名>或/ var / log / syslog中什么都没有显示

来自分类Dev

为什么IE浏览器显示“ scanstyles在webkit / firefox Internet Explorer中什么都没有”?

来自分类Dev

登录后什么都没有

来自分类Dev

kubuntu 12.04什么都没有?

来自分类Dev

doctest期望什么都没有

来自分类Dev

Shell脚本:什么都没有?

来自分类Dev

UIScrollView:什么都没有滚动

来自分类Dev

什么都没有回来?

来自分类Dev

为什么每次读取文件行时我的对象都没有存储到数组中?爪哇

Related 相关文章

  1. 1

    为什么整个部分都没有显示背景

  2. 2

    在Spyder上使用Altair时,为什么我的两个图形都没有显示?

  3. 3

    我可以在整个PHP脚本中将“”(什么都没有)定义为“ 0”吗?

  4. 4

    为什么什么都没有出现?

  5. 5

    为什么$ 1输出什么都没有?

  6. 6

    为什么LongListSelector selectedItem什么都没有?

  7. 7

    为什么$ 1输出什么都没有?

  8. 8

    为什么我的所有流程都没有立即开始?

  9. 9

    带有CardView的RecyclerView:什么都没有显示

  10. 10

    为什么我的每个循环都没有返回任何东西?

  11. 11

    为什么我的每个单词反转代码都没有反转某些单词?

  12. 12

    为什么单击或更改事件都没有触发我的功能?

  13. 13

    为什么在每行之后都没有打印?

  14. 14

    为什么在每行之后都没有打印?

  15. 15

    网页的CSS错误..什么都没有显示

  16. 16

    嵌入jQuery日历插件-什么都没有显示?

  17. 17

    JFrame中什么都没有显示

  18. 18

    我的$ {document).ready里面什么都没有

  19. 19

    硬盘快满了,但是我什么都没有

  20. 20

    代码和SQL查询中有什么错误?为什么网页上什么都没有显示?

  21. 21

    我的cron没有运行,在/ var / mail / <用户名>或/ var / log / syslog中什么都没有显示

  22. 22

    为什么IE浏览器显示“ scanstyles在webkit / firefox Internet Explorer中什么都没有”?

  23. 23

    登录后什么都没有

  24. 24

    kubuntu 12.04什么都没有?

  25. 25

    doctest期望什么都没有

  26. 26

    Shell脚本:什么都没有?

  27. 27

    UIScrollView:什么都没有滚动

  28. 28

    什么都没有回来?

  29. 29

    为什么每次读取文件行时我的对象都没有存储到数组中?爪哇

热门标签

归档