因此,我在项目的 styles.xml 文件中更改了操作栏的背景。我认为我做错了一切,因为图形布局没有任何变化,但是当我将它上传到我的手机并运行它时,颜色很好。
我尝试右键单击>打开方式>android 布局编辑器,但操作栏的颜色仍然是灰色。
如何更新 activity_main.xml 的“图形布局”选项卡中的预览?
供引用:我的 styles.xml 是:
<?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>
activity_main.xml 是:
<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>
提前致谢!
最佳答案
在 Eclipse 的图形布局 View 中,选项卡顶部有一个下拉选择框,旁边有一个蓝色/灰色的星号,旁边是当前应用的主题名称。确保为预览选择了正确的主题。
关于android - 为什么当我更新 ActionBar 的背景颜色时图形布局 View 没有改变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20692125/