简体   繁体   中英

Why doesn't the Graphical Layout view change when I update the background color of my ActionBar?

So I've changed the background of my Action Bar in a styles.xml file in my project. I thought that I was doing everything wrong because nothing was changing in the graphical layout, but when I uploaded it to my phone and ran it, the colors were fine.

I tried right clicking>open with> android layout editor, but the color of the Action Bar remains grey.

How can I update the preview in the 'Graphical Layout' tab of my activity_main.xml?

For reference: my styles.xml is:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="Theme.ActionBar.Background" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/ActionBar.Solid.StockGetter</item>
    </style>

    <style name="ActionBar.Solid.StockGetter" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
        <item name="android:background">@color/OrangePeel</item>

    </style>

And the activity_main.xml is:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <EditText
        android:id="@+id/enterStockSymbolEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:hint="@string/enter_stock_symbol"
        android:inputType="text"
        android:maxLength="10"
        android:scrollHorizontally="true" />

    <Button
        android:id="@+id/enterStockSymbolButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/enterStockSymbolButton" />

</LinearLayout>

Thanks in advance!

In the Graphical Layout view of Eclipse, there is a drop down selection box at the top of the tab which has a blue/grey star next to with the name of the currently applied theme name. Make sure you have the correct theme selected for your preview.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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