Android Studio:我还可以在清单中使用带有appcompat主题的HOLO Light DatePicker吗?

问题描述 投票:0回答:1

我最近开始在我的应用程序中自定义工具栏,我的清单应用程序部分看起来像这样。

  <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轻微旋转器样式的日期选择器出现了。现在绿色日历显示为datepicker。我猜它与Theme.AppCompat.Light.NoActionBar的清单添加有关,我认为这对于我的自定义工具栏是必要的,但是有一个工作来保持我的微调器样式HOLO light datepicker吗?

我感谢任何帮助。

android datepicker manifest toolbar android-appcompat
1个回答
0
投票

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

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

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

© www.soinside.com 2019 - 2024. All rights reserved.