2010-12-02 81 views

回答

5
<Button 
     android:id="@+id/A" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="40dip" 
     android:textSize="14sp" 
     android:text="--Button1--" /> 

<Button 
     android:id="@+id/B" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/A" 
     android:gravity="center" 
     android:text="Button2" 
     android:layout_alignLeft="@id/A" 
     android:layout_alignRight="@id/A" 
     android:textSize="14sp" /> 

試試上面的內部你RelativeLayout

+0

我嘗試過這一點,並沒有奏效。這就是我發佈這個問題的原因。無論如何感謝您嘗試@Varun。 – 2010-12-02 10:54:24

0

如果你想按鈕2依賴於按鍵1的,那麼有沒有辦法(據我所知),這樣做。但是,如果您正在設計動態佈局,則可以以編程方式進行。

1

你在找什麼應該是layout_alignRight。這會將您的View的右邊緣與指定錨的右邊緣對齊。

相關問題