Android Styling/Theming of just Search Dialog

后端 未结 2 2091
南方客
南方客 2021-01-20 03:58

tl;dr: White text style in app theme being picked up by search dialog, making search text invisible.

I\'m struggling mightily with what seems like a

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-20 04:36

    I got into the same problem as you. I've looked around for a solution but it seems that you just can't change the textColor of a dialog. My solution was creating a custom dialog based on this tutorial: http://blog.androgames.net/10/custom-android-dialog/

    I extended this a lot based on the Android source code, always using the same method names etc to make it a bit easier.

    It is not ideal, but as far as I know it's the best option...

    EDIT: for your problem there might be a simpler solution: don't put the textColor into the theme, but put it in a style. I don't know how you're styling your app but I'm usually creating a "master-style" which all the others inherit from (direct or indirect). You could then put the textColor in there so all your standard dialogs will still have the standard textColor.

提交回复
热议问题