2012-04-03 15 views
0

イメージボタンをいくつか持つカスタムアクションバーを作成する必要があります。クリックするとメニューリストがドロップされます。ドロップダウンチャイルドでカスタムアクションバーを作成する方法

私は線形レイアウトを使ってアクションバーを設計しました。

私のメインアクティビティに添付されたコントロールとクリックイベントが処理されましたが、ドロップダウンコントロールの作成方法はわかりません。

クリックしたボタンの下にドロップダウンコントロールを配置するとします。どうすればこのことができますか?

は、これがカスタマイズされたレイアウトとアクションアイテムを置き換え

アクションバーあなたはActionProviderクラスで使用可能なアクション・プロバイダでこれを行うことができます

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
       android:background="#FFFFFF"> 
    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:background="@drawable/actionbar_background" 
     android:layout_height="65dp"> 
    <Button android:id="@+id/btntest" 
      android:layout_marginLeft="50dp" 
      android:text="Sup" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 
    <Button android:id="@+id/btntest1" 
      android:layout_marginLeft="100dp" 
      android:text="Company" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 
    <Button android:id="@+id/btntest2" 
      android:layout_marginLeft="100dp" 
      android:text="Client" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_alignParentBottom="true" 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
    </LinearLayout> 
</FrameLayout> 

答えて

0

のための私のコードです...しかし、それはまた、すべてのアイテムの振る舞いを制御します。それはまた、メニューのデフォルトのイベントを処理項目の外観を制御すること以外に

...

の詳細情報へのリンクを確認...

http://developer.android.com/guide/topics/ui/actionbar.html#ActionView

関連する問題