相关疑难解决方法(0)

如何为布局设置不同的主题

我为整个应用设置了默认主题.它在styles.xml中定义如下:

    <style name="DefaultTheme" parent="@android:style/Theme.Holo.Light">
        <!-- Customization here -->
    </style>
Run Code Online (Sandbox Code Playgroud)

我还定义了一个黑暗的主题:

    <style name="DarkTheme" parent="@android:style/Theme.Holo">
        <!-- Customization here -->
    </style>
Run Code Online (Sandbox Code Playgroud)

在清单中,它被声明为轻主题作为应用程序的主题:

    <application
    ...
    android:theme="@style/DefaultTheme" >
Run Code Online (Sandbox Code Playgroud)

现在这个工作正常,但在一个活动中,我需要为单个布局设置不同的主题.像这样的东西:

    +--------------------------------------------------+
    |         Parent Linear layout (default theme)     |
    |                                                  |
    | +------------------------------------+ +-------+ |
    | |                                    | |       | |
    | |     Left linear layout             | |       | |
    | |     (default theme)                | |       | |
    | |                                    | |       | |
    | |                                    | |       | |
    | |                                    | |    ·<----------- Right Linear …
Run Code Online (Sandbox Code Playgroud)

user-interface android themes styles android-linearlayout

31
推荐指数
3
解决办法
2万
查看次数