![](/img/trans.png)
[英]Android: how to set two buttons in vertical linear layout to same width?
[英]Android Studio 3 Vertical Buttons Same Width
我個人會通過添加一個方向設置為“垂直”的線性布局來解決這個問題。
檢查此示例 xml 代碼:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0.49$ / Month"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="4.99$ / Year"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="14.99$ / Forever"/>
</LinearLayout>
希望我的回答對你有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.