簡體   English   中英

我試圖在 LinearLayout 的底部放置一個按鈕。 但它沒有顯示

[英]I am trying to place a button at the bottom of LinearLayout. But it's not showing

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Quantity" />

    <TextView
        android:id="@+id/quantity_text_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="0"
        android:textColor="@color/black"
        android:textSize="16sp" />

    <Button
        android:id="@+id/button_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" Order" />

</LinearLayout>

我是 Android 的新手。 我正在 Udacity 學習 Android。 但是課程已經很老了,以至於發生了一些錯誤。 我無法處理錯誤。

截圖解釋

quantity_text_view的 layout_height 從match_parent更改為wrap_content

<TextView
        android:id="@+id/quantity_text_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="0"
        android:textColor="@color/black"
        android:textSize="16sp" />

或者,TextView 應該占據第一個 TextView 之后的高度的 rest。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM