我想将一些风格应用于VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:43:18)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
-clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
。在platform's attrs.xml
中,我们可以看到DatePicker
styleable的以下属性:
DatePicker
虽然我可以引用<declare-styleable name="DatePicker">
...
<!-- The text color for the selected date header text, ex. "2014" or
"Tue, Mar 18". This should be a color state list where the
activated state will be used when the year picker or day picker is
active.-->
<attr name="headerTextColor" format="color" />
<!-- The background for the selected date header. -->
<attr name="headerBackground" />
...
</declare-styleable>
,但我不能对android:headerBackground
属性这样做。因此,请遵循android:headerTextColor
中的代码:
styles.xml
提示错误,<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.DatePicker">
<item name="android:headerBackground">@color/red</item>
<item name="android:headerTextColor">@color/red</item>
</style>
无法解析。
但我可以clearly see android:headerTextColor
覆盖该属性。有趣的是,这段代码前面带有Widget.Material.DatePicker
注释,这可能会以某种方式导致此行为的原因。
这种行为可能是什么原因以及如何覆盖该属性?
在Android Studio 2.3上运行,minSdkVersion 23,buildToolsVersion 25.0.3, compileSdkVersion&amp; targetSdkVersion 23,无效的缓存和清理的项目。
正如您在R.attr
docs中所看到的,有一些属性背后的文字:
此常量在API级别23中已弃用。请改用 headerTextColor 。
这意味着,此属性应该公开给公共API,但不知何故它被剥离而AAPT无法访问它。
在错误跟踪器上打开an issue。
答案 0 :(得分:3)
答案 1 :(得分:0)
已经有一段时间了,但是由于尚未解决,我通过在这样的片段中调用picker.show()之后,获取标题的视图ID,然后直接以编程方式设置文本颜色来解决此问题。希望这将对遇到这个问题的人有所帮助。
int yearSpinnerId = Resources.getSystem().getIdentifier("date_picker_header_year", "id", "android");
AppCompatTextView year = picker.findViewById(yearSpinnerId);
int headerTextId = Resources.getSystem().getIdentifier("date_picker_header_date", "id", "android");
AppCompatTextView selectedDate = picker.findViewById(headerTextId);
year.setTextColor(getResources().getColor(R.color.white_FFFFFF));
selectedDate.setTextColor(getResources().getColor(R.color.white_FFFFFF));
答案 2 :(得分:-1)
尝试使用此
Style.xml
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Model model) {
model.addAttribute("data", new Shop());
return "shop/edit";
}
@RequestMapping(value = "/edit/update", method = RequestMethod.POST)
public String update(@ModelAttribute Shop shop) {
if (shop.getId() == null) {
shopService.createShop(shop);
}
return "redirect:/";
}
值文件夹 attr.xml
<style name="DatePicker">
<item name="android:headerBackground">@color/colorPrimaryDark</item>
<item name="headerTextColor">@color/colorAccent</item>
</style>