gpt4 book ai didi

android - android 9.0 中的 Dark Theme 使我的应用布局变丑了

转载 作者:太空狗 更新时间:2023-10-29 13:44:43 26 4
gpt4 key购买 nike

我只是在设计我的布局,没想到会出现任何问题,但有一天 android 9.0 发布了,我带上手机并在其中安装了我的应用程序,并尝试在夜间模式下打开我的应用程序,我开始看到白色颜色布局在黑暗中发生变化,我的思绪被阻塞了。我想知道如何禁用主题。

I tried changing themes, changing the background colors none of those works

<RelativeLayout
android:layout_width="190dp"
android:layout_height="200dp"
android:layout_marginTop="-15dp"
android:layout_below="@+id/tableTxt"
android:background="@drawable/table_no_orders_border"
android:theme="@style/ThemeOverlay.AppCompat.Light"
android:layout_centerHorizontal="true">

<android.support.v7.widget.CardView
android:id="@+id/cv_one_login"
android:layout_width="189dp"
android:layout_height="199dp"
android:layout_centerHorizontal="true"
android:elevation="10dp"
app:cardCornerRadius="1dp"
app:cardElevation="10dp"
android:layout_marginTop="0.1dp">

<android.support.v4.widget.NestedScrollView
android:id="@+id/sv1"
android:layout_width="match_parent"
android:layout_height="147dp"
android:scrollbars="vertical"
android:scrollbarSize="10dp"
android:isScrollContainer="true">
<TextView
android:id="@+id/tableItems"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/table"
android:layout_marginStart="5dp"
android:layout_marginTop="13dp"
android:textColor="@color/TextcolorforBlack"/>
</android.support.v4.widget.NestedScrollView>
<TextView
android:id="@+id/totalTableBill"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/total_bill"
android:textColor="@color/SettingsColor"
android:layout_below="@id/sv1"
android:textAlignment="gravity"
android:gravity="bottom"
android:layout_marginStart="5dp"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>

我需要我设计的布局。即使应用了主题,它也应该是相同的。

enter image description here

最佳答案

您可以将 App 主题更改为 App Manifest 文件中的任何主题,例如,

<application 
android:theme="@android:style/Theme.Holo"/>

<application
android:theme="@android:style/Theme.Holo.Light"/>

<application
android:theme="@android:style/Theme.Black"/>

<application
android:theme="@android:style/Theme.DeviceDefault"/>

或者你可以在styles.xml文件中自定义主题,然后在Manifest中应用

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

现在在 list 文件中

<application 
android:theme="@style/AppBaseTheme"/>

您还可以在 Android Studio 的预览窗口中预览主题。

enter image description here

关于android - android 9.0 中的 Dark Theme 使我的应用布局变丑了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56573786/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com