Dark Theme в Android 9.0 меняет макеты моего приложения безобразно - PullRequest
3 голосов
/ 13 июня 2019

Я просто проектирую свой макет, не ожидая каких-либо проблем, но запустился однодневный 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

1 Ответ

1 голос
/ 13 июня 2019

Вы можете изменить тему приложения на любую тему в файле манифеста приложения, например,

<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"/>

Теперь в файле манифеста

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

Вы также можете просмотреть темы в окне предварительного просмотра в Android Studio.

enter image description here

...