0
我寫了自己的視圖欄,它擴展了LinearLayout
。我的酒吧有兩個地方用於添加按鈕或其他視圖。使我的視圖能夠接受xml中的子視圖
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>
是否possiable辦?
PS:
我的左,右孩子的地方已經擴展的LinearLayout。 – Nik
然後,您必須能夠像使用LinearLayouts一樣將控件添加到佈局中。 –
請看圖像頂部。顯示地點,我想要添加項目。 – Nik