繁体   English   中英

将应用程序主题应用于布局中的框架/布局

[英]applying app theme to frames/layouts within layouts

我有我的片段主布局,它在其中使用其他布局......上部和下部布局。

当从浅色主题更改为深色主题时,主布局会应用应用程序主题......但链接布局不会。 我怎样才能让他们也将应用程序主题与主布局一起应用?

这是主要布局

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".activity.main.fragment.back_office.reports.ReportsMainFragment">

    <data>

    </data>

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/_10sdp">

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_h_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent=".75" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_h_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent=".20" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/topView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@id/gl_h_2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <include layout="@layout/inventory_reports_top_area" />  <-- upper layout
    </androidx.constraintlayout.widget.ConstraintLayout>
...

上层布局是这样的

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_v_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent=".17" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_v_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent=".34" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_v_3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent=".51" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_v_4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent=".68" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gl_v_5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent=".85" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_3sdp"
        android:background="@drawable/report_rounded_border_white"
        android:elevation="1dp"
        android:padding="@dimen/_5sdp"
        app:layout_constraintEnd_toStartOf="@id/gl_v_1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/tv_reports_inventory_total"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Total Bookings"
            android:textColor="@color/black"
            android:textSize="@dimen/_5ssp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

...

暂无
暂无

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

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