0

を拡張する独自のビューバーを作成しましたLinearLayout。私のバーには、ボタンやその他のビューを追加するための2つの場所があります。次に、次のようなコードを使用してバーにアイテムを追加します。

bar.addItemToLeft(view);また bar.addItemToRight(view);

私のバーが。のようなxmlでチャイルズビューを受け入れることができるようにしたいと思いLinearLayoutます。

例えば:

<com.my.ui.Bar
    android:id="@+id/bar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

        <com.my.ui.BarLeft
               android:layout_width="wrap_content"
           android:layout_height="wrap_content">

               <View/> <View/> <View/>

        </com.my.ui.BarLeft>

         <com.my.ui.BarRight
               android:layout_width="wrap_content"
           android:layout_height="wrap_content">

               <View/> <View/> <View/>

        </com.my.ui.BarLeft>

</com.my.ui.Bar>

することは可能ですか?

PS:

ここに画像の説明を入力してください

4

1 に答える 1

1

子を許可するには、左右のバーでViewGroup(LinearLayout、relativeLayout)を拡張する必要があります。

よろしく、Aqif Hamid

于 2012-06-29T06:12:27.450 に答える