【问题标题】:Android Studio: Can I still use HOLO Light DatePicker with appcompat theme in manifest?Android Studio:我仍然可以在清单中使用带有 appcompat 主题的 HOLO Light DatePicker 吗?
【发布时间】:2017-12-28 02:37:01
【问题描述】:

我最近开始在我的应用程序中自定义工具栏,我的清单应用程序部分如下所示..

  <application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar">
    <activity android:name=".MainActivity"
              android:screenOrientation="portrait"
              android:theme="@style/Theme.AppCompat.Light.NoActionBar">

我将此代码添加到我的 mainactivity java....

    Toolbar myToolbar = findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);

这是我的主要 xml 文件...

 <android.support.v7.widget.Toolbar
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="#0277bd"
    android:elevation="4dp"
    android:text="@string/app_name"
    android:textColor="#e1f5fe"
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

在添加这个之前,我的 HOLO 光微调器样式的日期选择器出现了。现在绿色日历显示为日期选择器。我猜它与 Theme.AppCompat.Light.NoActionBar 的清单添加有关,我认为这对我的自定义工具栏是必要的,但是有没有办法让我的微调器样式 HOLO 轻日期选择器保持不变?

感谢您的帮助。

【问题讨论】:

    标签: android datepicker manifest toolbar android-appcompat


    【解决方案1】:

    我研究并发现将此代码添加到我的样式文件中:

     <style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorAccent">#42a5f5</item>
     </style>
    

    我没有得到 DatePicker 的 HALO 灯光对话框,但我能够使用我喜欢的新日历并更改颜色以匹配我的应用程序的主题。我知道没有人回答或回答我的问题,但我想我会发布我想出的答案,以防有人看到这个问题并遇到同样的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多