在新的Android版本中的旧式搜索栏

时间:2015-04-09 00:21:27

标签: android android-seekbar

1型

enter image description here

2型

enter image description here

<SeekBar
                android:id="@+id/SeekBarTestPlay"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />

说明

我所知道的

  • 我知道android使用Type-1样式来降低sdk和 更高级别的type-2样式

我想做什么

  • 我试图在较低和较高的sdk中使用type-1样式

{编辑}

<SeekBar
                android:id="@+id/SeekBarTestPlay"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:theme="@android:style/Theme.NoTitleBar"/>

2 个答案:

答案 0 :(得分:2)

可以使用适当的@android:style/Widget样式应用Gingerbread小部件样式。

<SeekBar
    android:id="@+id/SeekBarTestPlay"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    style="@android:style/Widget.SeekBar" />

如果您想强制应用中的所有SeekBar看起来像Gingerbread搜索栏,您可以在主题中设置android:seekBarStyle属性。

<style name="AppTheme" ...>
    <item name="android:seekBarStyle">@android:style/Widget.SeekBar</item>
</style>

如果您希望整个应用看起来像Gingerbread,您可以设置您的应用主题以扩展基本主题。

<style name="AppTheme" parent="android:Theme">
    ...
</style>

答案 1 :(得分:1)

您可以为android:theme指定SeekBar属性,其样式将在支持它的所有API级别中显示。您想要为类型1所需的主题称为主题

android:theme="@android:style/Theme"