ActionBarSherlock and custom TextBox (extends AutoCompleteTextView)

时光毁灭记忆、已成空白 提交于 2019-12-13 14:51:43

问题


OK, I'm going crazy over this - I've integrated ActionBarSherlock in my app and am using Theme.Sherlock. Now, I can't seem to get my custom textbox to work properly - whenever I leave textbox, text becomes white. Here is image to better explain the problem (I've used Overlay layout from examples that come with the library):

Typing:

Going back to EditText:

Does anyone have idea why this is happening?

EDIT: To reproduce this error simply download the ActionBar zip and extract sample project. Then in that project in Overlay layout (res/layout/overlay.xml) in first LinearLayout just add:

<EditText 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:imeOptions="actionNext" />
<AutoCompleteTextView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

And run sample project on device with older version of Android OS.


回答1:


OK, now I get it why nobody was able to answer this - it seems to happen only on specific devices! So, in my case I was reproducing it on old Amazon Kindle.

The current workaround I finally found, that works for me, is to set textColor of my control by getting textColor of default EditText (yeah, pretty ugly).

If someone has better idea - do let me know.




回答2:


  • What are the minimum and target SDK versions?
  • Which theme are you using with your application/activity?

Extend that default theme you are using and define the text colors there. See Inheritance



来源:https://stackoverflow.com/questions/15352148/actionbarsherlock-and-custom-textbox-extends-autocompletetextview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!