[英]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.