在我的應用程序屏幕中,我有兩個按鈕。一個是激活,另一個是關於。我想在左側激活,在右側激活並且尺寸相同。我寫下面的代碼:如何在android的兩側佈置兩個按鈕?
<LinearLayout
android:id="@+id/layout2"
android:layout_width="fill_parent"
android:layout_height="60px"
android:layout_alignParentBottom="true"
android:background="@drawable/bottom_bar"
>
<Button
android:id="@+id/btnActivate"
android:layout_width="0dp"
android:layout_height="40px"
android:layout_marginTop="10px"
android:layout_weight="1.0"
android:text="Activate"
android:textColor="#000000"
>
</Button>
<Button
android:id="@+id/btnAbout"
android:layout_weight="1.0"
android:layout_width="0dp"
android:layout_height="40px"
android:layout_marginTop="10px"
android:text="About"
android:textColor="#000000"
>
</Button>
</LinearLayout>
現在這兩個按鈕都來了相同的大小。但我希望它們具有60dp的特定寬度。我怎樣才能做到這一點??
在此先感謝。
你已經在你的寬度屬性上設置了0dp。您的按鈕不會以這種方式顯示。 – hovanessyan