【发布时间】:2010-12-20 11:50:49
【问题描述】:
我正在尝试在 android 中创建一个自定义视图(或更好的布局),用作 2 个子视图的容器(将其视为垂直分隔 2 个容器的条形,可以上下滑动)。
我想像使用 xml 中的布局一样使用它,以便您可以在其中嵌套任何视图。 我想到了这样的事情:
<view class="at.calista.quatscha.views.SwipebarLayout"
android:id="@+id/sbl"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Top View -->
<Button android:text="Top" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<!-- Bottom View -->
<Button android:text="Bottom" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</view>
这个 xml 应该给我两个按钮之间的滑动栏。
但是,我不知道如何做到这一点,我正在扩展 LinearLayout atm,但是我如何告诉我的孩子如何定位自己?
【问题讨论】: