簡體   English   中英

ScrollView中的LinearLayout不顯示按鈕

[英]LinearLayout in ScrollView not displaying button

在下面的代碼中:

<ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:orientation="vertical">

        <TextView
                android:layout_marginTop="20dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="27sp"
                android:text="@string/create_card_text"/>

        <TextView
                android:layout_marginTop="20dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="24sp"
                android:textColor="#ff949494"
                android:text="@string/create_card_info_text_one"/>

        <EditText
                android:id="@+id/name"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="40dp"
                android:hint="Name"/>

        <EditText
                android:id="@+id/email"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:inputType="textEmailAddress"
                android:hint="Email"/>

        <TextView
                android:id="@+id/phone_number"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textSize="20sp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="20dp"
                android:hint="Phone Number"/>

        <Button
                android:id="@+id/next_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:layout_marginLeft="280dp"
                android:text="@string/create_card_next_button"
                android:onClick="next"/>

    </LinearLayout>

</ScrollView>

該按鈕只是不顯示。 有什么事嗎

嘗試這樣。

您已設置android:layout_marginLeft="280dp"因此將其替換為

android:layout_marginLeft="20dp"或其他

所以基本上您按鈕的代碼看起來像這樣

<Button
     android:id="@+id/next_button"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginTop="20dp"
     android:layout_marginLeft="20dp"
     android:text="@string/create_card_next_button"
     android:onClick="next"/>

我認為您已將裕度設置為280dp ,這會引起問題,並將其設置在屏幕外,將其設置為20dp或按照您的屏幕要求設置其他,它應該可以工作。

暫無
暫無

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

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