现在的位置: 首页 > 综合 > 正文

使Android原生时间选择器样式为滚轮

2017年12月17日 ⁄ 综合 ⁄ 共 1163字 ⁄ 字号 评论关闭

很简单,修改styles.xml代码

    <style
name="AppBaseTheme"
parent="android:Theme.Light">

        <!--

            Theme customizations available in newer API levels can go in

            res/values-vXX/styles.xml, while customizations related to

            backward-compatibility can go here.

        -->

    </style>


   <!-- Application theme. -->

    <style
name="AppTheme"
parent="AppBaseTheme">

        <!-- All customizations that are NOT specific to a particular API-level can go here. -->

    </style>

为:

    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">

        <!--

            Theme customizations available in newer API levels can go in

            res/values-vXX/styles.xml, while customizations related to

            backward-compatibility can go here.

        -->

    </style>


   <!-- Application theme. -->

    <style
name="AppTheme"
parent="AppBaseTheme">

        <!-- All customizations that are NOT specific to a particular API-level can go here. -->

    </style>

然后

AndroidManifest.xml文件中设置android:theme="@style/AppTheme"

    <application

        android:name=".AppContext"

        android:allowBackup="true"

        android:icon="@drawable/logo"

        android:label="@string/app_name"

        android:launchMode="singleTask"

        android:screenOrientation="portrait"

        android:theme="@style/AppTheme"
>

   </application>


 运行程序可观察前后对比效果





抱歉!评论已关闭.