Android - Overflow小部件喜欢ActionBar

时间:2012-09-04 17:41:42

标签: android widget overflow android-actionbar

我想创建自己的操作栏,其中包含按钮列表(带文字的图标)。这有溢出功能:     - 只要数字按钮太多(或者因为长文本而宽度超过屏幕尺寸),则此操作栏必须溢出。样本是HTC手机的天气应用如下:

       overflow action bar

和:

     enter image description here

我们可以翻转操作栏中的按钮来执行指定的操作。

Android已经引入了ActionBar并且它具有溢出功能。但是这不适合我们的期望,所以我想创建自己的小部件。

有谁知道如何实施它?
感谢。

1 个答案:

答案 0 :(得分:0)

您可以使用HorizontalScrollView,并将所有内容放入其中。通过将布局宽度设置为match_parent并将布局高度设置为wrap_content,您可以实现几乎相同的效果。

<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <!-- Put the buttons here -->
</HorizontalScrollView>
相关问题