带有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
最满意答案
一些想法:
这是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.)
相关问答
更多-
将几个依赖的C ++ makefile项目移植到MSVC中(Porting several dependent C++ makefile projects into MSVC)[2022-07-15]
您可以在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 ...
-
Makefile循环依赖(Makefile circular dependency)[2022-10-21]
@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 ...
-
Makefile依赖于make run的一个可执行文件的两个变体(Makefile two variants of one executable dependent on make run)[2022-03-02]
这里最简单的事情可能只是复制目标: 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 ... -
这个Makefile如何工作?(How does this Makefile work?)[2024-04-13]
以下规则创建一个静态库,该库依赖于编译所有已发现源文件所产生的目标文件: 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 ...
-
makefile依赖无效(makefile dependent has no effect)[2024-01-02]
您可以在显示的.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 ...