首页 \ 问答 \ 带有Theme.AppCompat.Light.DarkActionBar的ActionBarCompat显示白色标题文本,但显示黑色微调文本(ActionBarCompat with Theme.AppCompat.Light.DarkActionBar shows white title text but black spinner text)

带有Theme.AppCompat.Light.DarkActionBar的ActionBarCompat显示白色标题文本,但显示黑色微调文本(ActionBarCompat with Theme.AppCompat.Light.DarkActionBar shows white title text but black spinner text)

我在ActionBar中使用了ActionBarCompat和标题文本,后跟一个微调器。 我使用的主题Theme.AppCompat.Light.DarkActionBar应该在黑色背景上显示白色文本。 标题文本显示为白色,但微调文本显示为黑色。 将主题切换到Theme.AppCompat.Light的白色都是黑色文本。 任何人都可以提出如何将白色文本加入微调器? 我已经看到了ActionBar和ActionBarSherlock的建议,但无法让他们在ActionBarCompat上工作。 我已经按照以下方式尝试过样式但没有成功:

    <style name="SBRRTheme" parent="AppTheme">
    <item name="android:spinnerDropDownItemStyle">@style/SBRRCustomDropDownItemStyle</item>
</style>

<style name="SBRRCustomDropDownItemStyle"> parent="@android:style/Widget.AppCompat.Light.DropDownItem.Spinner">
    <item name="android:textAppearance">@style/SBRRCustomDropDownItemTextStyle</item>
</style>

<style name="SBRRCustomDropDownItemTextStyle"> parent="@android:style/Widget.AppCompat.Spinner.DropDown.ActionBar">
    <item name="android:textColor">@color/white</item>
</style>

清单中的活动定义是:

        <activity
        android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
        android:name="com.example.actionbar2.RaceResultsActivity"
        android:label="@string/action_raceresults"
        android:parentActivityName=".MainActivity" >
        <meta-data android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>

进一步的信息,在使用Nexus-S仿真器和物理Galaxy S2进行测试并运行JellyBean之后,ActionBarCompat本身的Spinner外观问题本身只出现在我的开发设备 - 运行2.3.5 Gingerbread的Galaxy Y上。 也显示在2.3.3 AVD上。


I'm using the ActionBarCompat and both Title text followed by a spinner in the ActionBar. I'm using theme Theme.AppCompat.Light.DarkActionBar which should show white text on a black background. The title text does show in white but the spinner text appear in black. Switching the theme to Theme.AppCompat.Light has both as black text on white. Can anyone suggest how I can get white text into the spinner? I've seen suggestions for ActionBar and ActionBarSherlock but can't get them to work on ActionBarCompat. I've tried styles as per the following without success:

    <style name="SBRRTheme" parent="AppTheme">
    <item name="android:spinnerDropDownItemStyle">@style/SBRRCustomDropDownItemStyle</item>
</style>

<style name="SBRRCustomDropDownItemStyle"> parent="@android:style/Widget.AppCompat.Light.DropDownItem.Spinner">
    <item name="android:textAppearance">@style/SBRRCustomDropDownItemTextStyle</item>
</style>

<style name="SBRRCustomDropDownItemTextStyle"> parent="@android:style/Widget.AppCompat.Spinner.DropDown.ActionBar">
    <item name="android:textColor">@color/white</item>
</style>

The activity definition in the manifest is:

        <activity
        android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
        android:name="com.example.actionbar2.RaceResultsActivity"
        android:label="@string/action_raceresults"
        android:parentActivityName=".MainActivity" >
        <meta-data android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>

Further information, after testing with a Nexus-S emulator and on a physical Galaxy S2, both running JellyBean, the problem with the spinner appearance in the ActionBarCompat itself only shows up on my development device, a Galaxy Y running 2.3.5 Gingerbread. Also shows on a 2.3.3 AVD.


原文:https://stackoverflow.com/questions/18318331
更新时间:2023-10-09 14:10

最满意答案

一些想法:

  • 这是GNU autoconf旨在解决的那种情况。 运行./configure ,找出可用的库,并生成适当的Makefile。

  • 您可以通过执行以下操作来获取当前主机名:

    HOST=$(shell hostname)
    

    然后,您可以在条件中使用它。

  • 你可以让你的Makefile做类似的事情:

    include Makefile.local
    

    然后在每个主机上有不同的Makefile.local文件。

Re:你的评论,给出像这样的Makefile:

HOST=$(shell hostname)

all:
    @echo $(HOST)

将生成以下输出:

$ make all
fafnir.local

(假设你当地的主人是“fafnir.local”。我的是哪个。)


A few thoughts:

  • This is the sort of situation GNU autoconf was designed to address. Run ./configure, figure out what libraries are available, and generate an appropriate Makefile.

  • You could get the current hostname by doing something like:

    HOST=$(shell hostname)
    

    You could then use this in your conditional.

  • You could instead have your Makefile do something like:

    include Makefile.local
    

    And then have different Makefile.local files on each host.

Re: your comment, given a Makefile like this:

HOST=$(shell hostname)

all:
    @echo $(HOST)

Will generate the following output:

$ make all
fafnir.local

(Assuming your local host is "fafnir.local". Which mine is.)

相关问答

更多
  • 您可以在Visual Studio中创建项目依赖项。 为项目分配依赖项 在Solution Explorer中,选择一个项目。 在“项目”菜单上,选择“项目依赖项”。 将打开“项目依赖项”对话框。 在“依赖关系”选项卡上,从“项目”下拉菜单中选择一个项目。 在Depends on字段中,选中在此项目之前必须构建的任何其他项目的复选框。 你可以在这里阅读更多相关信息 You can create project dependence in Visual Studio. To assign dependenci ...
  • 您应该为库创建一个虚拟依赖项,以便始终处理它们的Makefile。 这是一个很好的例子和解释: http : //owen.sj.ca.us/~rk/howto/slides/make/slides/makerecurs.html You should make a dummy dependency for the libraries so that their Makefiles are always processed. Here is a good example and explanation: h ...
  • 你或多或少都是对的,但可以说得更清楚一点。 你是如何选择初始目标的,当然,如果用户在make命令行中指定了一个特定目标,那么使用该目标而不是第一个目标。 然后make基本上为每个目标实现一个递归算法,其工作方式如下: 找到构建该目标的规则。 如果没有规则来构建目标,则make失败。 对于目标的每个先决条件,运行此算法并将该先决条件作为目标。 如果目标不存在,或者任何先决条件的修改时间比目标的修改时间更新,请运行与目标关联的配方。 如果配方失败,(通常)失败。 而已! 当然,这隐藏了许多复杂的问题:特别是在没 ...
  • 一些想法: 这是GNU autoconf旨在解决的那种情况。 运行./configure ,找出可用的库,并生成适当的Makefile。 您可以通过执行以下操作来获取当前主机名: HOST=$(shell hostname) 然后,您可以在条件中使用它。 你可以让你的Makefile做类似的事情: include Makefile.local 然后在每个主机上有不同的Makefile.local文件。 Re:你的评论,给出像这样的Makefile: HOST=$(shell hostname) all ...
  • @aaa carp是正确的,这是一个隐含的规则,但它不是LEX规则之一,因为它们从Nl构建Nc或Nr ,这是一个从No构建N的规则。 在我看来,像“链接单个目标文件”规则,在info (make) Catalogue of Rules描述。 将.lex文件重命名为.l文件将解决此问题。 另外:运行flex ,我认为你真的不需要.tab.h文件来构建词法分析器源码。 试试这个: %.l.c: %.l flex -o$@ $< program.l.o: program.tab.h 这将为program ...
  • -MM已经生成了makefile格式的依赖关系,所以你可以通过为每个.cpp生成一个相同的文件,然后只是做一个“-include $(DEPS_FILE)”来简化它。 这可能比使用eval更可维护。 -MM will already generate the dependencies on a Makefile format so you could simplify this by generating the dependencies for each *.cpp into a same file, t ...
  • 这里最简单的事情可能只是复制目标: client: client.o open.o close.o gcc -g -o $@ $^ client-normal: client.o gcc -g -o $@ $^ 然后运行make client-normal来生成client-normal二进制文件。 (请注意,我用适当的自动变量替换了手动列出的输出和输入文件,以避免重复。) 如果你想使用make make MODE=normal (或类似),那么你可以这样做: ifneq (normal ...
  • 以下规则创建一个静态库,该库依赖于编译所有已发现源文件所产生的目标文件: googleapis.ar: $(GOOGLEAPIS_CCS:.cc=.o) ar r $@ $? 这种方式的工作方式是$(GOOGLEAPIS_CCS:.cc=.o)意味着“接受变量GOOGLEAPIS_CCS ,并在其中,用.o替换每个出现的.cc ”。 也就是说,将发现的源列表转换为将从它们生成的目标文件列表。 因为这是在先决条件行上, make将尝试查找如何生成这些对象的规则。 Makefile中没有用于构建.o文 ...
  • 为每个编译好的.o文件提供一个不同的名称,并简单地链接到您想要的已编译的.o文件是不是更有意义? instance: instance.cpp $(IMPL_O) $(CC) $(FLAGS) $^ -o $@ # propably no need to override default rule 使用make IMPL_O=implementation2.o在您的问题中生成示例。 这样,每个文件的名称都能真正显示其标识,您无需明确跟踪任何内容。 (显然,你可以将.o扩展名重构为Makefile ...
  • 您可以在显示的.d文件的输出中看到问题: a1.o: /home/haochen/Work/test_code/test_makefile/dir1/a1.c \ 这里的目标是a1.o 但是,您实际构建的目标是$(OUTPUT_DIR)/a1.o 。 因此,make不会将这些额外的先决条件应用于该目标,因此它不会检查它们以确定它们在构建该目标时是否已更改。 您需要将目标名称作为您正在构建的确切目标:您可以使用-MT选项。 例如: $(OUTPUT_DIR)/%.o: %.c @mkdir ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)