简体   繁体   English

Android 9.0中的黑暗主题改变了我的应用程序布局难看

[英]Dark Theme in android 9.0 changes my app layouts ugly

I am just designing my layout without expecting any of the problems, but one-day android 9.0 launched and I brought the phone and installed my app in it and tried my app opening it with night mode ON and I started to see white color layout changes in dark and my minds goes block. 我只是设计我的布局而不期待任何问题,但推出了一天的Android 9.0,我带了手机并安装了我的应用程序并尝试我的应用程序打开它与夜间模式打开,我开始看到白色颜色布局更改在黑暗中,我的思绪陷入困境。 I want to know how to disable the theme. 我想知道如何禁用主题。

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>

I need my layout as it is designed. 因为它的设计我需要我的布局。 even if the theme got applied also it should be the same. 即使主题得到应用也应该是相同的。

在此输入图像描述

You can change App theme to any theme in the App Manifest file like, 您可以将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"/>

Or you can customize theme in the styles.xml file and then Apply in Manifest 或者,您可以在styles.xml文件中自定义主题,然后在Manifest中应用

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

Now in Manifest file 现在在Manifest文件中

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

You can also preview themes in the preview window in Android Studio. 您还可以在Android Studio的预览窗口中预览主题。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM