首页 \ 问答 \ 为什么“ParentBackground”在Windows Classic主题中不起作用?(Why “ParentBackground” doesn't work at Windows Classic theme ? (Delphi))

为什么“ParentBackground”在Windows Classic主题中不起作用?(Why “ParentBackground” doesn't work at Windows Classic theme ? (Delphi))

我在表单上使用工具栏和面板。

第一张图 :Windows 7 Normal主题,Panel的ParentBackground = True:

替代文字

第二张图 :Windows 7 Classic主题,PanelB的ParentBackground = True:

替代文字

为什么“ParentBackground”属性在Windows Classic主题中不起作用? 我该如何解决这个问题?


i use a toolbar and a panel on my form .

First picture : Windows 7 Normal theme , ParentBackground for Panel = True :

alt text

Second picture : Windows 7 Classic theme , ParentBackground for Panel = True :

alt text

Why "ParentBackground" property doesn't work at Windows Classic theme ? and how can i solve this problem ?


原文:https://stackoverflow.com/questions/4346330
更新时间:2023-08-07 14:08

最满意答案

尝试这个

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
       android:weightSum="9"
       android:gravity="center"
        >
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="SN : "

                android:layout_weight="1" />

            <TextView
                android:id="@+id/serialNumberView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                 android:layout_weight="2" 
                 android:text="saasdasd ssadasd sadas asd sd sd"/>

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Ver : "
                 android:layout_weight="1" />

            <TextView
                android:id="@+id/versionView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:layout_gravity="center"
                 android:layout_weight="2"
                  android:text="saasdasd ssadasd sadas asd sd sd" 
                />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Type : "
                android:layout_gravity="center"
                   android:layout_weight="1" 

                 />

            <TextView
                android:id="@+id/typeView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:layout_gravity="center"
                  android:layout_weight="2" 
                   android:text="saasdasd ssadasd sadas asd sd sd" />

    </LinearLayout>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:orientation="vertical"
                android:layout_weight="1">


                    <CheckBox
                        android:id="@+id/floatCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Float" />

                    <CheckBox
                        android:id="@+id/tripCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Trip" />

                    <CheckBox
                        android:id="@+id/closeCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Close" />

                    <CheckBox
                        android:id="@+id/blockedCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Blocked" />

                    <CheckBox
                        android:id="@+id/hardTripCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Hard Trip" />

                    <CheckBox 
                        android:id="@+id/phaseAngleCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Phase angle wrong for closing" />

                    <CheckBox
                        android:id="@+id/diffVoltsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Differential volts too low" />

                    <CheckBox
                        android:id="@+id/networkVoltsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Network volts too low to close" />

                    <CheckBox
                        android:id="@+id/usingDefaultsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Using Defaults( Reprogram )" />

                    <CheckBox
                        android:id="@+id/relaxedCloseActiveCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Relaxed Close Active" />

                    <CheckBox
                        android:id="@+id/commBoardDetectedCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Comm Board Detected" />

                    <CheckBox 
                        android:id="@+id/antiPumpBlock"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Anti-Pump Block" />

                    <CheckBox
                        android:id="@+id/motorCutoffCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Motor Cutoff Inhibit" />

                    <CheckBox
                        android:id="@+id/phaseRotationCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Phase Rotation Wrong" />

                    <CheckBox
                        android:id="@+id/usingDefaultDNPCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text= "Using Default DNP Profile" />
            </LinearLayout>
    </ScrollView>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="1" >

        <Button
            android:id="@+id/button3"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:text="Back"
            android:layout_weight=".5" />

        <Button
            android:id="@+id/button3"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:text="Read"
            android:layout_weight=".5" />
    </LinearLayout>
</LinearLayout>

在这里输入图像描述


try this

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
       android:weightSum="9"
       android:gravity="center"
        >
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="SN : "

                android:layout_weight="1" />

            <TextView
                android:id="@+id/serialNumberView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                 android:layout_weight="2" 
                 android:text="saasdasd ssadasd sadas asd sd sd"/>

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Ver : "
                 android:layout_weight="1" />

            <TextView
                android:id="@+id/versionView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:layout_gravity="center"
                 android:layout_weight="2"
                  android:text="saasdasd ssadasd sadas asd sd sd" 
                />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Type : "
                android:layout_gravity="center"
                   android:layout_weight="1" 

                 />

            <TextView
                android:id="@+id/typeView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:layout_gravity="center"
                  android:layout_weight="2" 
                   android:text="saasdasd ssadasd sadas asd sd sd" />

    </LinearLayout>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:orientation="vertical"
                android:layout_weight="1">


                    <CheckBox
                        android:id="@+id/floatCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Float" />

                    <CheckBox
                        android:id="@+id/tripCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Trip" />

                    <CheckBox
                        android:id="@+id/closeCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Close" />

                    <CheckBox
                        android:id="@+id/blockedCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Blocked" />

                    <CheckBox
                        android:id="@+id/hardTripCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Hard Trip" />

                    <CheckBox 
                        android:id="@+id/phaseAngleCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Phase angle wrong for closing" />

                    <CheckBox
                        android:id="@+id/diffVoltsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Differential volts too low" />

                    <CheckBox
                        android:id="@+id/networkVoltsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Network volts too low to close" />

                    <CheckBox
                        android:id="@+id/usingDefaultsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Using Defaults( Reprogram )" />

                    <CheckBox
                        android:id="@+id/relaxedCloseActiveCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Relaxed Close Active" />

                    <CheckBox
                        android:id="@+id/commBoardDetectedCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Comm Board Detected" />

                    <CheckBox 
                        android:id="@+id/antiPumpBlock"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Anti-Pump Block" />

                    <CheckBox
                        android:id="@+id/motorCutoffCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Motor Cutoff Inhibit" />

                    <CheckBox
                        android:id="@+id/phaseRotationCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Phase Rotation Wrong" />

                    <CheckBox
                        android:id="@+id/usingDefaultDNPCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text= "Using Default DNP Profile" />
            </LinearLayout>
    </ScrollView>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="1" >

        <Button
            android:id="@+id/button3"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:text="Back"
            android:layout_weight=".5" />

        <Button
            android:id="@+id/button3"
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:text="Read"
            android:layout_weight=".5" />
    </LinearLayout>
</LinearLayout>

enter image description here

相关问答

更多