2010-01-01 46 views
3

我正在尋找一個視圖或某種有關Android默認應用程序(如電子郵件或底下的解鎖模式)的底欄的信息,如下圖所示。我無法在Android網站或Google搜索中找到任何有關此信息的內容。是否有按鈕欄的視圖? (描述視圖的圖片鏈接)

圖片:http://img11.imageshack.us/i/viewdn.jpg/

+0

我打電話重複:http://stackoverflow.com/questions/2127459/which-android-control-to-use/2224638 – 2010-02-10 13:40:10

回答

2

我不相信有在這些應用程序的底部使用按鈕欄任何標準視圖。通常只有兩個Button項目放在一起,即LinearLayoutRelativeLayout

例如,在看Android Open Source Project,可以看到button bar for one of the email app setup screens被定義爲兩個普通的舊的Button對象。

但是,令人驚訝的是,Google沒有將更多的常見內容抽象到Android主題或子佈局中,而不是在每個佈局XML中具有相同的視圖和屬性。

7

我相信克里斯托弗是正確的;沒有特殊的小部件可以在圖像中創建欄。但是,如果要模擬它,可以創建佈局並使用樣式style="@android:style/ButtonBar"。這會給你淺灰色背景和正確的邊距。

+0

酷!以前沒有看過那種風格。然而谷歌不會在他們自己的應用中使用它(當然,從我看過的幾個版面來看)。 – 2010-01-02 01:47:49

0

來源:http://code.google.com/p/k9mail/source/browse/k9mail/trunk/res/layout/account_setup_basics.xml?r=1314

<RelativeLayout 
     android:layout_marginTop="-45dip" 
     android:padding="0dip" 
     android:layout_alignParentBottom="true" 
     android:gravity="bottom|right" 
     android:background="@android:drawable/bottom_bar" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"> 
     <Button 
      android:id="@+id/manual_setup" 
      android:text="@string/account_setup_basics_manual_setup_action" 
      android:minWidth="@dimen/button_minWidth" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_marginBottom="-4dip" 
      android:layout_alignParentLeft="true" 
      android:layout_centerVertical="false" 
      /> 
     <Button 
      android:id="@+id/next" 
      android:text="@string/next_action" 
      android:minWidth="@dimen/button_minWidth" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:drawableRight="@drawable/button_indicator_next" 
      android:layout_marginBottom="-4dip" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="false" 
      /> 
    </RelativeLayout> 
相關問題