[英]How to add a toolbar to an Android Activity?
當您單擊允許轉推,回復等的消息時,Android的官方Twitter客戶端有一個很好的工具欄。如何重新創建這樣的工具欄?
對於LinearLayout方法,代碼很簡單,只需添加一些權重並玩弄你想要的東西。 這讓您大致了解該方法:
<EditText android:text="Example Layout"
android:layout_width="match_parent"
android:id="@+id/editText"
android:layout_height="wrap_content"
android:layout_weight="0.95"></EditText>
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:weightSum="1.0"
android:padding="1px"
android:layout_height="wrap_content"
android:layout_weight="0.05">
<ImageButton android:id="@+id/testButton1"
android:layout_weight="0.2"
android:background="@drawable/btn"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<ImageButton android:id="@+id/testButton2"
android:layout_weight="0.2"
android:background="@drawable/btn"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<ImageButton android:id="@+id/testButton3"
android:layout_weight="0.2"
android:background="@drawable/btn"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<ImageButton android:id="@+id/testButton4"
android:layout_weight="0.2"
android:background="@drawable/btn"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
<ImageButton android:id="@+id/testButton5"
android:layout_weight="0.2"
android:background="@drawable/btn"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
</LinearLayout>
結果如下: http : //i.stack.imgur.com/bShgb.png
您也可以對ActionBar感到滿意,只需觀看API要求: http : //developer.android.com/guide/topics/ui/actionbar.html
我們稱之為QuickAction:
有關如何實現它的更多信息,請訪問: http : //www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.